Batch Scripting

Windows OS Specific Topics
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Batch Scripting

Post by Nipuna » Fri Oct 08, 2010 12:20 pm

I like to know about Windows Batch Scripting.

Can you Guys add a Windows Batch Scripting article to Expertcore ?

Thanks
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: Batch Scripting

Post by Saman » Fri Oct 08, 2010 1:06 pm

Wrong section :twisted:
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Batch Scripting

Post by Nipuna » Fri Oct 08, 2010 1:34 pm

Saman wrote:Wrong section :twisted:
OOps Sorry. My Mistake Thanks for Reminding Me.
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Batch Scripting

Post by Neo » Fri Oct 08, 2010 3:22 pm

Moved to Windows :)

Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with, the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.

In PowerShell, administrative tasks are generally performed by cmdlets (pronounced command-lets), specialized .NET classes implementing a particular operation. Sets of cmdlets may be combined together in scripts, executables (which are standalone applications), or by instantiating regular .NET classes (or WMI/COM Objects). These work by accessing data in different data stores, like the filesystem or registry, which are made available to the PowerShell runtime via Windows PowerShell providers. Read more here.

Download Windows PowerShell

Read more at Microsoft TechNet.
Windows PowerShell starting point in TechNet
Windows PowerShell owners manual.
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Batch Scripting

Post by Nipuna » Fri Oct 08, 2010 6:53 pm

Thanks Neo, :) :)

but I want to know simple things. Like

"Echo off" and more.

You Told a Great One But I want to know Simple ones.

I mean that we can Write on notepad and save as .bat files then can run.

Thanks
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Batch Scripting

Post by Neo » Sat Oct 09, 2010 3:06 am

Though batch files with .bat extension still works on Windows, that was created for DOS. If you want to know more on it, read Using batch files.

However, on Windows, there is another way to do it more elegantly. It's called Windows Script Host.

Example: WSH sample

Anyway, PowerShell is a very powerful tool that gives more control over standard scripting methods.

Each of these scripting methods address simple to complicated scripting requirements. You will have do Google and find some examples from each to see what suits you the best.
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Batch Scripting

Post by Nipuna » Sat Oct 09, 2010 8:24 am

I Want know to about simple things. like this

Code: Select all

echo off
make dir
I can't remember exactly
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Batch Scripting

Post by Neo » Sat Oct 09, 2010 8:41 pm

You don't read posts carefully. See the first link on my previous post. It's about the legacy batch scripting method that you refer.

BTW: It is not make dir. It is mkdir.

You can use whatever DOS command within a batch file (.bat). You can get the List of DOS commands here. Echo is also a DOS command that usually used to toggle echoing of commands on and off in batch files.
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: Batch Scripting

Post by Nipuna » Sat Oct 09, 2010 8:55 pm

Thanks Neo,
And Sorry for not reading well :( By doing those I am eating Up your Valuable time. Really Sorry. :(

Please Tell me if i am a Trouble to you.
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Batch Scripting

Post by Neo » Sun Oct 10, 2010 3:12 pm

Please Tell me if i am a Trouble to you.
If that is the case, I'll tell you personally :lol:

However read carefully, especially the referring links and all. Normally we spend quite a lot of time on answering posts. It is not easy as we have to go through several pages and read whether it matches you, etc... I'm sure no one will be happy if same question is asked without reading previous post(s). Since you need to become an engineer on day, you need to understand that you will have to spend considerable time on reading and learning carefully.
Post Reply

Return to “Windows”