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

x
?
Solved

How to execute CommandLine arguments ?

Posted on 2001-08-31
5
Medium Priority
?
1,827 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
[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
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 300 total points
ID: 6444115
For Win32-based applications, use the CreateProcess function. (Microsoft)
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

722 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