Solved

execute dos commands

Posted on 2001-07-16
3
432 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using idhttp to login to instagram 2 118
Delphi - replicating a form 8 90
Dev express lookupcombo 3 44
How to load 2 images in same column in Delphi 2 67
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

685 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