• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

run .exe and pass param with java script

New Here ,
Nov 30, 2011 Nov 30, 2011

Copy link to clipboard

Copied

dear All

can i execute .exe using java script and send parameter to the exe and get return value

is that possible

Thanks in advance

TOPICS
Scripting

Views

21.5K

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
community guidelines
People's Champ ,
Nov 30, 2011 Nov 30, 2011

Copy link to clipboard

Copied

From my point of view, you can take advantage of doScript calling VB that in return will run a command line running the exe with parameters.

I don't know much of VB but you can try playing with that snippet

var Wscpt = "Dim oShell\

Set oShell = CreateObject (\"WScript.Shell\")\

oShell.run (\"cmd /K dir c:\\ > c:\\dump.txt & exit\")";

var MScript = "do shell script \"echo hello world \"";

var scpt = (File.fs=="Windows")? Wscpt : MScript;

var language = (File.fs=="Windows")? ScriptLanguage.visualBasic : ScriptLanguage.APPLESCRIPT_LANGUAGE;

app.doScript(scpt, language);

You can still use File.execute() but unless I am wrong you cannot add parameters to that command.

Loic

Votes

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
community guidelines
New Here ,
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

hi Loic_aigon

thank you for your reply but,

i will use this application to run at mac pcs is it will run ok

or i need javascript only

Votes

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
community guidelines
LEGEND ,
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

LATEST

Macs don't have .EXE files.

You can do the equivalent AppleScript ("do shell script").

If you need it to work on both platforms, you'll have to check which platform you're on and run the appropriate platform-specific code.

Sorry, that's the way it is.

Votes

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
community guidelines