Solved

execute dos commands

Posted on 2001-07-16
3
431 Views
Last Modified: 2010-04-06
how can i execute dos commands under Delphi???


thanks

Charles
0
Comment
Question by:CarlosFCD
  • 3
3 Comments
 
LVL 1

Expert Comment

by:AngelFireMateo
ID: 6287174
WinExec(

    LPCSTR lpCmdLine,     // address of command line
    UINT uCmdShow      // window style for new application
   );    
 

Parameters

lpCmdLine

Points to a null-terminated character string that contains the command line (filename plus optional parameters) for the application to be executed. If the name of the executable file in the lpCmdLine parameter does not contain a directory path, Windows searches for the executable file in this sequence:

1.     The directory from which the application loaded.
     2.     The current directory.
     3.     The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
     4.     The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
     5.     The directories listed in the PATH environment variable.

 

uCmdShow

Specifies how a Windows-based application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO parameter to the CreateProcess function. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function. For a non-Windows - based application, the PIF file, if any, for the application determines the window state.

 

Return Values

If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values:


winexec('c:\command.com /c dir',SW_SHOWNORMAL     )


i hope this work

Ricardo
0
 
LVL 1

Accepted Solution

by:
AngelFireMateo earned 75 total points
ID: 6287175
WinExec(

    LPCSTR lpCmdLine,     // address of command line
    UINT uCmdShow      // window style for new application
   );    
 

Parameters

lpCmdLine

Points to a null-terminated character string that contains the command line (filename plus optional parameters) for the application to be executed. If the name of the executable file in the lpCmdLine parameter does not contain a directory path, Windows searches for the executable file in this sequence:

1.     The directory from which the application loaded.
     2.     The current directory.
     3.     The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
     4.     The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
     5.     The directories listed in the PATH environment variable.

 

uCmdShow

Specifies how a Windows-based application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO parameter to the CreateProcess function. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function. For a non-Windows - based application, the PIF file, if any, for the application determines the window state.

 

Return Values

If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values:


winexec('c:\command.com /c dir',SW_SHOWNORMAL     )


i hope this work

Ricardo
0
 
LVL 1

Expert Comment

by:AngelFireMateo
ID: 6287197
thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question