×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Executing notepad: Command line parameters?

Executing notepad: Command line parameters?

Executing notepad: Command line parameters?

(OP)
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

RE: Executing notepad: Command line parameters?

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:

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
http://student.vub.ac.be/~bvingerh/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: Executing notepad: Command line parameters?

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! ^^

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close