GeekTech
Saturday, July 19, 2008
MS-DOS: Getting back to the root of it all
Lately I have taken a deep interest in command prompting and especially batch files. Since we use batch files at work to run scripts for installing files and installing network printers and other miscellaneous tasks, I wanted to learn more about the cool things that are possible with building batch files. After reading through an online ebook I found that you can script batch files a way that is even more fun than doing it in notepad. To get here, start a command prompt. I'll make the following instructions in command prompt style: ('REM' means that it is just a remark. Do not actually type these.)
REM (In command prompt)
edit test.bat
REM This will actually create a batch file in your current folder (wherever command prompt is pointing)
REM Guess what? You are now in a true MS-DOS window. This goes back before command prompt. WOW.
@echo off
echo Hello. This is a test batch file.
pause
echo This batch file will now terminate.
pause
Okay, did you follow all of that? Now use your mouse to click file, and then save. And then go File > Exit. This will bring you back to command prompt. Now type 'test'. This should run your batch file. There are alot of advance commands that you can do like deleting files, moving files, and even some light programming like using the choice command.
The best thing you can do to find out more about commands is to actually use command prompt. If you type a command followed by /? it will display all the parameters and usages of that command and will usually give you an example. Seriously. Go try it out. You're not going to hurt anything.
REM (In command prompt)
edit test.bat
REM This will actually create a batch file in your current folder (wherever command prompt is pointing)
REM Guess what? You are now in a true MS-DOS window. This goes back before command prompt. WOW.
@echo off
echo Hello. This is a test batch file.
pause
echo This batch file will now terminate.
pause
Okay, did you follow all of that? Now use your mouse to click file, and then save. And then go File > Exit. This will bring you back to command prompt. Now type 'test'. This should run your batch file. There are alot of advance commands that you can do like deleting files, moving files, and even some light programming like using the choice command.
The best thing you can do to find out more about commands is to actually use command prompt. If you type a command followed by /? it will display all the parameters and usages of that command and will usually give you an example. Seriously. Go try it out. You're not going to hurt anything.
Labels: Programming, Software, tips
2 Comments:
Great! Now if only I still used winblows, I might find a use for this. Or perhaps you can help me make bash scripts for linux?
Oh and nice theme for the blog -- now, I dare you to dig into the code and remove the copyright material and the links back to final sense.
Keep it real-
Ben R.
Ic, but you didn't notice I already put a sweet theme on my blog, edited out the copyright crap, etc. I even tried to dig into it to set up new styles so my polls show up in the right fonts. All this stuff is old hand to me. lol
Keep it real-
benrr101
Post a Comment
<< Home