user2973481
user2973481

Reputation: 11

Run cmd.exe with command in TEdit (DELPHI)

I have question... I know how to run cmd from Delphi and I also know how to send command there. But problem is that the command is not always the same. I would like to send command which first part is always the same and second will be added from "TEdit1.text". Is that possible? Thank you very much for every answer! Villy

Upvotes: 0

Views: 3725

Answers (1)

David Heffernan
David Heffernan

Reputation: 612794

You are asking how to concatenate two strings. Use the + operator for that. For instance:

'cmd.exe /c ' + Edit1.Text; 

Based on your comment I think your code should be:

ShellExecute(Handle, 'runas', 'cmd.exe',
  PChar('/c netsh wlan set hostednetwork mode=allow ssid='+Edit1.Text),
  nil, SW_SHOWNORMAL);

Upvotes: 3

Related Questions