Solved

How to execute CommandLine arguments ?

Posted on 2001-08-31
5
1,811 Views
Last Modified: 2008-03-03
I'd like to know how to execute commandline arguments for instance 'netsend ', 'copy' from Delphi.

I've tried ShellExec :

ShellExecute(Application.Handle,'Open',PChar(CommandLine),'','',SW_HIDE)

and this seems to work fine for opening an exe but not for executing a single task like netsend or copy.

Regards
Andre

0
Comment
Question by:AndreDicks
5 Comments
 

Expert Comment

by:szjozsef
ID: 6444067
For that you need to run the command interpreter (command.com or cmd.exe) with the parameter /c <command name), eg. copy , net ...


Best Regards,
JSz.
0
 
LVL 1

Expert Comment

by:ntony
ID: 6444107
what about

UINT WinExec(

    LPCSTR  lpszCmdLine,     // address of command line
    UINT  fuCmdShow      // window style for new application
   );


i think that's what you need!
0
 
LVL 1

Accepted Solution

by:
ntony earned 100 total points
ID: 6444115
For Win32-based applications, use the CreateProcess function. (Microsoft)
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6444143
szjozsef  is right
you need to use command.com /c switch

ShellExecute(Application.Handle,'Open',PChar('command.com /c netsend pc1 hi),'','',SW_HIDE)
0
 

Author Comment

by:AndreDicks
ID: 6444283
ntony

Thx

Regards
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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