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

How can I pass the following cmd line command using system.callSystem() method?

Contributor ,
May 23, 2020 May 23, 2020

If I run this following line inside windows cmd line it create a json file on Desktop.

 

curl https://raw.githubusercontent.com/adiraimaji/checkforupdate/master/checkforupdate.json > %USERPROFILE%\Desktop\Testfile.json

 

But when I try to run this line using ExtendScript with system.callSystem() method, It doesn't work well..

What should I do to get this work? I've tried escaping special characters none of them works.

 

var curlCmd = 'cmd.exe /c curl https://raw.githubusercontent.com/adiraimaji/checkforupdate/master/checkforupdate.json > %USERPROFILE%\Desktop\Testfile.json';

var cmdLine = system.callSystem(curlCmd);

 

Can anyone tell me what should I do tho make it work? And if possible please tell me how can I achieve this on MacOS too.

Thanks in advance.

TOPICS
How to , Scripting
885
Translate
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 ,
May 23, 2020 May 23, 2020

Running cmd requires elevated user privileges, so this is bound to fail a majority of times for regular users, anyway. You need to create an actual socket connection in Extendscript itself and check for a manifest.xml or whatever you intend to use to handle your versioning.

 

Mylenium

Translate
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
Community Expert ,
May 23, 2020 May 23, 2020

Does it help to put the entire command in quotes?

var curlCmd = 'cmd.exe /c "curl https://raw.githubusercontent.com/adiraimaji/checkforupdate/master/checkforupdate.json > %USERPROFILE%\Desktop\Testfile.json"';
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
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
Contributor ,
May 23, 2020 May 23, 2020

Tried. Doesn't work.

Translate
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
Enthusiast ,
May 23, 2020 May 23, 2020
LATEST

In some cases the path that you have in your own commad prompt window is different than what system.callSystem() has.  Do you get different outputs when you run something like "echo %PATH%" from the command promo and from running it in system.callSystem() method?

 

Also note that the "curl" command is not, by default part of Windows installation.  Even though you have it on your machine, an end user may not have it.  You should use the absolute path to the executable if you know where it will exist on the end-user's machine.  "curl" is by default on all macOS installations so you can definitely use it there.  I strongly do not recommend ExtendScript sockets as they do not support SSL and it is quite slow.

 

hope this helps!

 

 

Translate
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