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!

Delphi 5 quick question: How do I run a system command?

Status
Not open for further replies.

namxat

Programmer
Oct 23, 2002
6
US
All I need is the syntax to execute a system command, such as "notepad c:\blah.txt". I am using Delphi 5 pro, but it has been awhile. Any help would be appreciated.
 
i think you could use Shellexecute which is detailed in the help file or this will work.

var
App : PChar;
begin
App := 'notepad.exe c:\blah.txt';
Winexec(App, 0);
end;
 
Here You Go:

ShellExecute(1 , 'open', 'notepad.exe c:\blah.txt', NIL, NIL, SW_SHOWNORMAL);

dont forget to add "shellapi" to the uses caluse at the top.


Hope this helps
 
Cool. Thank you. The ShellExecute command is working quite nicely for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top