Solved

execute dos commands

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now