Jump to content

Shellexecute / Run - help needed


Recommended Posts

The following works if manually entered from an admin (required) command prompt:

C:\windows\system32\curl.exe -s -k -H "Authorization: Bearer xxxxxAPI keyxxxxx" "http://192.168.0.117:3000/render/xxxxx" > c:\temp\test34.png

But not this :

#RequireAdmin
ShellExecute('C:\windows\system32\curl.exe','-s -k -H "Authorization: Bearer xxxxxAPI keyxxxxx" "http://192.168.0.117:3000/render/xxxxx" > c:\temp\test34.png')

Or this:

#RequireAdmin
Run('C:\windows\system32\curl.exe -s -k -H "Authorization: Bearer xxxxxAPI keyxxxxx" "http://192.168.0.117:3000/render/xxxxx" > c:\temp\test34.png')

 

The program seems to run but doesn't return result (png file creation), like when admin rights are missing.

 

Probably something obvious missing, Can someone assist with troubleshooting  ? Thank you!


 

Link to comment
Share on other sites

You need to start the shell to be able to redirect data to a file :

Run(@comspec & ' /c C:\windows\system32\curl.exe -s -k -H "Authorization: Bearer xxxxxAPI keyxxxxx" "http://192.168.0.117:3000/render/xxxxx" > c:\temp\test34.png')

 

Edited by Nine
Link to comment
Share on other sites

Alternatively, you could write the curl output to a file using the -o switch.

#RequireAdmin

ShellExecute('C:\windows\system32\curl.exe','-sk -H "Authorization: Bearer xxxxxAPI keyxxxxx" -o c:\temp\test34.png "http://192.168.0.117:3000/render/xxxxx"')

or

Run('C:\windows\system32\curl.exe -sk -H "Authorization: Bearer xxxxxAPI keyxxxxx" -o c:\temp\test34.png "http://192.168.0.117:3000/render/xxxxx"')

 

Edited by TheXman
Link to comment
Share on other sites

12 minutes ago, Homeseer666 said:

Is there a good write up on @comspec usage as I'd like to better understand how "/c" "/k" and other parameters/arguments are used.

Start with e.g. https://ss64.com/nt/cmd.html

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

24 minutes ago, Homeseer666 said:

are switch combinations allowed ?

Curl's single-dash options, that do not require additional information, can be combined.

https://curl.se/docs/manpage.html

Look under OPTIONS
 

Edited by TheXman
Link to comment
Share on other sites

1 minute ago, Nine said:

@Musashi has provided you my preferred link. ...

Mine as well ;).

@Homeseer666 : On https://ss64.com/nt/ you will find almost everything you need. There are also a number of commands that can be executed using Run and RunWait  directly (without @Comspec).

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...