Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing notepad: Command line parameters?

Status
Not open for further replies.

OzObdrOl

Programmer
Sep 29, 2001
9
ZA
Hello

Firstly: I have seen the forum entitled Executing external programs, and it just totally confused me.
I just want to know a simple thing: How can I execute a specific notepad file? What is the command line? And also am I correct if I say something like this:
Swapvectors;
Exec('C:\Windows\Notepad.exe',COMMANDLINE);
Swapvectors;

Please help ASAP, this has to be done within the next 4hours!!!
Thanks
Oz
 
The only files you can execute are applications; files with extension .TXT are datafiles that need to be opened with an application (like notepad).

You got the syntax of the exec procedure right, but, since you're working in DOS, you can't run windows programs. If you want to open a text file in an editor, you could try edit, which is a DOS text editor:
Code:
swapvectors;
exec(getenv('COMSPEC),'/Cedit '+file_to_edit);
swapvectors;
Getenv('COMSPEC') returns the path and filename of the command interpreter. This interpreter will then run the specified application and its parameters. Option /C makes the command interpreter quit when the application exits.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
I know its like a month late but w/e I just found the forum. You *can* run windows programs. No doubt you're on a windows machine if you're trying to load Notepad. Execute the program and window your DOS program to see it! ^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top