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

How To - Silently call command line apps with vbs and powershell (Windows)

Community Expert ,
Mar 10, 2020 Mar 10, 2020

Copy link to clipboard

Copied

I have been developing a Bridge script to call Adobe DNG Converter as it has a command line interface. However, Windows pops up an ugly command window when using app.system().

 

After some research, I've been able to call the DNG Converter silently using vbs and powershell.

 

You assemble a powershell command and write it to a .vbs (plain text) script file, then use file.execute() to run that script. I'm using Folder.temp to write into the user temp folder.

 

Syntax is as follows:

 

CreateObject("Wscript.Shell").Run "powershell -NoLogo -NoProfile -Command Start-Process -FilePath 'C:\Program Files\Adobe\Adobe DNG Converter\Adobe DNG Converter.exe' -ArgumentList '-c \""C:\Users\user\Pictures\Product Images\Incoming\test\20CH-L-PA.CR2\"" \""C:\Users\user\Pictures\Product Images\Incoming\test\20CH-L-PB.CR2\"" \""C:\Users\user\Pictures\Product Images\Incoming\test\21CH-L-A.CR2\""'", 0, True

 

Note the quoting, the escaped double double quotes are required to pass files with a space in the pathname. "-c" is the default command line switch for the DNG Converter, Adobe has a pdf with a list of all available switches. The 0 tells vbs to not show a GUI.

 

This isn't a problem on the Mac which (of course) is more elegant and doesn't show a Terminal window when you call app.system.

TOPICS
How to , Scripting

Views

545

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
community guidelines
LEGEND ,
Mar 10, 2020 Mar 10, 2020

Copy link to clipboard

Copied

LATEST

I don't like that Windows ugly command line window when using app.system() so I used VBScript too.

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