Does anyone know the code to open another program in dos?
Printable View
Does anyone know the code to open another program in dos?
Call system() and pass the name (including the path) of your other program, eg:
system ("c:\\testprogram.exe");
System not always a good option :
There a great post here on doing this very thing :
FAQ
I had a feeling it wasn't. To tell the truth I've never really opened a program from a program system() just popped into my head. Maybe I shouldn't have answered... :)
it not that bad in some cases, anyways i forgot to include
the usual dumb remark, so here it goes.
Did you really want to know how to open a program through
dos, or did you mean a command prompt, because they
are 2 different things?
I think he means from inside another program. :)Quote:
Does anyone know the code to open another program in dos?
yea i know that i was just being a a$$ lol
id already answered his question anyways.
I meant if i make a index program like if you input 1 then open this *.exe
what you should do is have a file
where the user can add the path to
any programs he wants then simply
read them in display them
let the user pick which one to run
then you can run it
the best way is to not rely on outside programs unless you have a way to verify that they are/are doing what you want/need them to be doing...
for examle, system(...) just basically sends a request to the OS. it's the same as typing directly on the command line. but that becomes a problem when something's not right. what happens when somebody moves notepad, or worse, replaces it with a malicious bit of code?
ILoveVectors was right about the difference between DOS and the command prompt, and it is a very valid point--don't get them confused. DOS is an old operating system, that is no longer included with newer windows operating systems.
for example, in windows 95, you can use DOS. in Windows XP, there is no DOS to use. when you bring up a command prompt and type in 'notepad.exe', it's pretty much the same as going through the start menu and clicking on notepad...