Process.execute command error

Post Reply
pradeepnitp
Newbie
Posts: 9
Joined: Tue Mar 18, 2014 3:17 pm

Process.execute command error

Post by pradeepnitp »

I have one cmd file which I want to execute via switchScripter



Switch Scriptercode is as below



var t = new Array("E:Enfocus_Flows_Testtest.cmd");

Process.execute(t)



This is always returning 1 and folder is also not created

If I run the cmd file manually then it is running fine.



test.cmd content is as below



cd E:Enfocus_Flows_Test

mkdir test2
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

Process.execute command error

Post by freddyp »

Apart from the fact that you have not finalized the Process.execute line with a semicolon I do not immediately see what is wrong, but I cannot test it on Windows right now.



Anyhow, why would you run a command file to create a directory when you can create one with the scripting API? Look under Scripting Reference - Utility Module - Dir Class.



Freddy
pradeepnitp
Newbie
Posts: 9
Joined: Tue Mar 18, 2014 3:17 pm

Process.execute command error

Post by pradeepnitp »

HI Freddy Semicolon was miss in typing .



Actually I need to do other stuffs inside cmd file .I thought of testing with small directory creation and even this is not working .
tz8
Member
Posts: 84
Joined: Mon Aug 13, 2012 12:56 pm

Process.execute command error

Post by tz8 »

create a property for the script and give it a "choose file" option. Then choose the test.cmd.



var args = new Array();

args.push( s.getPropertyValue( "Batchfile" ) );

var p = new Process( args );

p.start();

p.waitForFinished();



this always did the trick for me as the notation of filepaths can be rather tricky in SwitchScripter. You could also test Dir.convertSeparators( "c:blatest.cmd" )...
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Process.execute command error

Post by dkelly »



var exitStatus = Process.execute( s.getPropertyValue( "Batchfile" ) );


Post Reply