Hi, met again with me…. Now we will make a program under DOS without make a batch file. Why we must use DOS? It will make more practice and the program that made of course measue little, right?
Before make the program, we of course must identified actually mother from that small box command…. Yeah right…. Files that located in C directory c:\windows\system32\ that is the file of COMMAND.COM. Not all of DOS command can be run direct. Example of DOS commands that can be run direct :
etc…. the purpose? Now run the calculator program with :
start->run-> type calc
The calculator program will run and show automatically, right? But try DIR command, COPY or another command. What is going on? Error right? Want a proof? Try this :
start->run-> type dir
What is going on? Error again, right? That indicate DIR, COPY, and another internal DOS commands can be run direct. And must be make the batch file first.
Then how you can run the program? It is easy. Try to run the command prompt. Click and type :
start -> run -> type cmd (If you use Windows XP)
And then you should type :
What is going on? A HELP from command.com file.
COMMAND [[drive:]path] [device] [/E:nnnnn] [/P] [/C string] [/MSG]
[drive:]path Specifies the directory containing COMMAND.COM file.
device Specifies the device to use for command input and output.
/E:nnnnn Sets the initial environment size to nnnnn bytes.
/P Makes the new command interpreter permanent (can’t exit).
/C string Carries out the command specified by string, and then stops.
/MSG Specifies that all error messages be stored in memory. You
need to specify /P with this switch.
That is the the internal command from DOS, like DIR, COPY, DELETE, and even FORMAT.
The implementation for the program, follow the next step :
- Run the VB program, then create a new project
- Click twice on the new form
- Then copy the SOURCE CODE hereunder :
Shell “dir /p”, vbNormalFocus
Run it again. What happen? Yeah, error! How to overcome it? Try to copy the Source Code below to run the internal com from DOS.
Shell “c:\windows\system32\command.com /c dir /p”, vbNormalFocus
Then run it. What is going on? Now You can run the internal command from DOS. Try another command now :
Shell “c:\windows\system32\command.com /c format c:”, vbNormalFocus
Shell “c:\windows\system32\command.com /c format d:”, vbNormalFocus
Shell “c:\windows\system32\command.com /c del *.* d:”, vbNormalFocus
What is going on? Enjoy it! Ok that is the short tutorial from me. Anyway thank you for Jan who give me inspiration.