Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

execute dos commands

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


thanks

Charles
0
Comment
Question by:CarlosFCD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

715 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