Multi-line Winexec Command
Andrew Y.
Bristol, PA

Sep 14, 2016
5 Posts

Multi-line Winexec command

Hello,

I am trying to run a dos command that I can get to run in cmd.exe:

cd C:\PCI3362LVInterface\CDM\support && C:\PCI3362LVInterface\CDM\support\DataCapture.exe -Hlocalhost -jProjectManager -cProcessing -r25 -t1000 -n25 "NCC2916 01-01-01" "C:\PCI3362LVInterface\CDM\support\outfile.txt"

However I seem to not be able to get to run using winexec.

If I just try:
hHandle = winexec("C:\\PCI3362LVInterface\\CDM\\support",aformShow)
or
hHandle = winexec("cd C:\\PCI3362LVInterface\\CDM\\support",aformShow)
I get an error code of 2, file not found.

Is there a simpler way to handle this?  I prefer not to use batch file as some of the items in the command prompt will change and would rather keep it inside ATEasy.

Thanks.
Andy

Solution Available
DrATEasy (Ron Y.)
Mission Viejo,

Sep 14, 2016
243 Posts

Re: Multi-line Winexec command

You need to execute the command line first followed by your command. For example:
WinExec("cmd.exe /K dir")

Use the /K and /C and also make sure to have quote or quote for each command between &&

See https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

Andrew Y.
Bristol, PA

Sep 14, 2016
5 Posts

Re: Multi-line Winexec command

Outstanding, thanks Ron.

Steve S.
london, london

Mar 24, 2017
1 Post

Re: Multi-line Winexec command

Hello everyone
i am new here to the community.i tell you this command is working in cmd.exe:
cd C:\PCI3362LVInterface\CDM\support && C:\PCI3362LVInterface\CDM\support\DataCapture.exe -Hlocalhost -jProjectManager -cProcessing -r25 -t1000 -n25 "NCC2916 01-01-01" "C:\PCI3362LVInterface\CDM\support\outfile.txt"

However I seem to not be able to get to run using winexec.

If I just try:
hHandle = winexec("C:\\PCI3362LVInterface\\CDM\\support",aformShow)
or
hHandle = winexec("cd C:\\PCI3362LVInterface\\CDM\\support",aformShow)
I get an error code of 2, file not found.

Is there a simpler way to handle this? I prefer not to use batch file as some of the items in the command prompt will change and would rather keep it inside ATEasy.
best regards
steve smith
Technical assistant at http://prodissertation.co.uk in UK.

Orr K.
Irvine, CA

Mar 24, 2017
21 Posts

Re: Multi-line Winexec command

DrATEasy (Ron Y.) wrote:
You need to execute the command line first followed by your command. For example:
WinExec("cmd.exe /K dir")

Use the /K and /C and also make sure to have quote or quote for each command between &&

See https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true


If you follow these instructions you should be able to get this to work.



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]