Solved

How to execute CommandLine arguments ?

Posted on 2001-08-31
5
1,824 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 100 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…
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…
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 …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

623 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