Yes, I just refuse to use PowerShell (just yet). I know that powershell can do this and that and god MSFT knows what not but with all these bells and whistles doesn’t come at cheap price. I mean if something works just fine and smooth then why you actually need to use something new.

It is true for good ‘ol DOS (with BATCH file). I still use it for most of my automation tasks. The most good thing about DOS is it doesn’t require me to Google much because I know what I need to do if I am required to do something. But if I am asked to do same thing using Powershell then it is very likely that I will spend more time browsing through forums to find solution. I am not saying that PS is the worst shell ever invented Open-mouthed smile … but I think it is not justified to spend time on it unless it can do something that I can’t do using DOS(read it as WITH BATCH file).

Couple of days ago I was tasked to create some sort of script to automate updating of one of our demo server. A colleague of mine suggested me to use PS to streamline the process but I found that I can do it easily with using DOS commands in batch file. Two of the command that I used were START and TASKKILL,

START : This command is used to start any application. For example,

start notepad.exe

Above command will fireup notepad. This seem to be very simple command but it is very handy when you want to start any application from BATCH file. Another use could be to open website from command prompt.

start http://gaurangpatel.net

Above command will open up http://gaurangpatel.net in your default browser. Neat, right ??

Another useful command was,

TASKKILL : This command is used to kill any task. This command can use few switches with it for different options like force kill or kill whole process tree. What I really liked about this command is, it can actually kill exes by just name!! You also have option to kill task by process ID or service. You can read in more details about this command at TechNet.

TASKKILL /IM notepad.exe

Above command will kill an EXE with name notepad.exe. Another option could be to use force kill by adding switch /F. Key point about this command is it can also be used to kill task on remote machine, using switch /S

 

DOS_Commands

Just as a side note, if you are using windows 7 or vista (still on vista ?? really ??) then you may need to open command prompt as Administrator.

Ok, this is enough for now.

I will post more commands later on.

It’s Just A Thought … Peace

Gaurang Sign

Random Posts:


Similar Posts: