Recent

Author Topic: Initiating Windows Shell Commands  (Read 4915 times)

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Initiating Windows Shell Commands
« on: July 02, 2010, 01:28:19 am »
How would I execute a Windows Shell command programmicly?
Code: Pascal  [Select][+][-]
  1. ShellExecute(Handle,'open','command.com',Whatevercommand,nil,SW_SHOW);
  2.  
Just brings up cmd, with no commands in it. Cmd then stays up.
Thanks in advance,
- Josh
« Last Edit: July 02, 2010, 01:32:55 am by Joshuzzz »
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: Initiating Windows Shell Commands
« Reply #1 on: July 02, 2010, 04:21:23 pm »
Try running 'command /?' in a command box.
You'll see that '/C <actual command>' does the trick.
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11947
  • FPC developer.
Re: Initiating Windows Shell Commands
« Reply #2 on: July 05, 2010, 11:21:27 am »
How would I execute a Windows Shell command programmicly?
Code: Pascal  [Select][+][-]
  1. ShellExecute(Handle,'open','command.com',Whatevercommand,nil,SW_SHOW);
  2.  
Just brings up cmd, with no commands in it. Cmd then stays up.
 

(the windows shell is cmd.exe, command.com is the dos compatibility shell)

 

TinyPortal © 2005-2018