Skip to main content
Participating Frequently
July 31, 2009
Answered

Run .bat file with arguments?

  • July 31, 2009
  • 3 replies
  • 14356 views

Hi,

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

var myFile=new File("c:\\test.bat");

myFile.execute();

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

This topic has been closed for replies.
Correct answer D¡rk Becker

How 'bout setting environment variables?

type test.bat

echo %BLA% > c:\test.txt

$.setenv("BLA","value");

File("c:\\test.bat").execute();

Dirk

3 replies

Jongware
Community Expert
Community Expert
July 31, 2009

How 'bout always writing out the batch file in full, with the parameters already in place? Then you'd only have to execute it.

The consensus here seems to be Adobe didn't count on anyone trying to run an MS-DOS style batch file from within InDesign

D¡rk BeckerCorrect answer
Inspiring
July 31, 2009

How 'bout setting environment variables?

type test.bat

echo %BLA% > c:\test.txt

$.setenv("BLA","value");

File("c:\\test.bat").execute();

Dirk

kumar1981Author
Participating Frequently
July 31, 2009

Hi,

  Thank you very much. It is helpful answer and it is working...

Regards

Kumar

Inspiring
November 6, 2012

HI,

          I need to run .bat file without showing the command prompt screen. am using Indesign cs5.5 with Windows7 OS.

Harbs.
Legend
July 31, 2009

How 'bout creating a temporary shell script which executes the batch

with the parameters? You then just execute the shell script which

executes the batch in turn...

Harbs