Highlighted

Opening a Command Prompt and entering a command

Community Beginner ,
May 01, 2019

Copy link to clipboard

Copied

I am trying to create a script which opens a command prompt and enters a command line.

var cmdpath = "C://WINDOWS/system32/cmd.exe"

var cmdfile =File(cmdpath)

function cmdrun(){

return cmdfile.execute()

}

cmdfile.execute() // hopefully open with command /C dir

This currently opens a command prompt window (or PowerShell if you change the path correctly), but I have yet to find a way to get a command line entered into cmd.

I have read a variety of ways it can be done in other Adobe programs app.system, system.callSystem, etc but have yet to find a method for FrameMaker. I have seen a person reference an app Method() but I am unable to find this reference again.

Cheers

Create a batch file and execute that.

TOPICS
Scripting

Views

691

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Opening a Command Prompt and entering a command

Community Beginner ,
May 01, 2019

Copy link to clipboard

Copied

I am trying to create a script which opens a command prompt and enters a command line.

var cmdpath = "C://WINDOWS/system32/cmd.exe"

var cmdfile =File(cmdpath)

function cmdrun(){

return cmdfile.execute()

}

cmdfile.execute() // hopefully open with command /C dir

This currently opens a command prompt window (or PowerShell if you change the path correctly), but I have yet to find a way to get a command line entered into cmd.

I have read a variety of ways it can be done in other Adobe programs app.system, system.callSystem, etc but have yet to find a method for FrameMaker. I have seen a person reference an app Method() but I am unable to find this reference again.

Cheers

Create a batch file and execute that.

TOPICS
Scripting

Views

692

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 01, 2019 0
Advocate ,
May 01, 2019

Copy link to clipboard

Copied

Create a batch file and execute that.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 01, 2019 0
Community Beginner ,
May 01, 2019

Copy link to clipboard

Copied

As 4everJang​ mentioned, the way to do this is to create a new batch file or write to a preexisting batch file.

var commandpath = "C://FilePath/command.bat

var commandfile = File(commandpath)

var command = "ECHO OFF"+"\n"+"dir"+"\n"+"PAUSE";

commandfile.open("w");

commandfile.write(command);

commandfile.close();

commandfile.execute();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 01, 2019 0