Windows Scripting : Stupid Basic

 

 

WARNING: Absolutely nothing in this is ground breaking, it’s just meant to be another easy-to-follow guide to scripting.

 

I probably won’t ever move beyond anything in Windows Scripting that isn’t basic for a long time. At least until I take it within the upcoming semesters. However, scripting is a fun way to automate tasks to make doing stuff like tedious directory navigation and program launching much faster and only one click!

Scripting consists of creating a .txt file, and renaming it .bat. Batch files have simple commands that are “read” and excuted in proper order to accomplish something. This is how programmers reach files embedded inside labirynth-like folder structures without wearing themselves out. However, writing simple scripts requires knowledge of command line terminology and commands. While I’m more versed in the Linux universe, many things are similar here on the Windows side of thing.

The script I’ll demonstrate today will simply  execute more than one program at a time. 

The only command we will need to know is:

start – Start indicates you would like to open up a new command prompt and then execute any following commands. 

The only other thing we’ll need to know is what the absolute file path is for the program you want to run. That means the long “C:\User\Michael\Program Files\StormChaser\Beer\mandibula\loller.exe” path. Now, the two programs I find myself needing to run when I start the computer up is Pidgin and Steam. Their paths are:

 “C:\Program Files\Valve\Steam\steam.exe ”

“C:\Program Files\Pidgin\pidgin.exe”

Now we have everything we need for the script. Open up notepad and type in:

start “” “C:\Program Files\Filepath to your program\theprogram.exe ”

start “” “C:\Program Files\changethis\otherprogram.exe”

That’s it, that’s the entire script. Notice the double quotes after start. That’s called a parameter, we are telling the start command that we would like the title of our window to have no name. 

Now save the file as a .bat instead of .txt. Close it, now double click on it. Assuming your absolute paths are correct (and with copy and paste they should be perfect), the programs will launch simultaneously. Now, this does feel a lot like a glorified shortcut, but remember how basic this is. You can clear clutter from your desktop with this kind of power. Albeit Windows won’t let you change the icon, so it’s not very pretty.

I do realize this is a semi-embarassing post for scripting, but it’ll ease the reader into the concepts of commands and scripting. I’ll try to tailor these to where you can get by with “filling in the blanks”, you just copy and paste the commands and tailor it to your needs. These articles will not only maybe make things easier for you, but improve my own scripting abilities.

One advantage to this is that you can clear your startup list, so your computer starts faster and you can choose at your leisure when the program set should be run.

 

Next time we’ll be looking at true automation and repitition, a batch file that will continuously execute a file/or command until you tell it otherwise or a condition is met.

 

Cheers,

Michael

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: