Reputation: 1
I just want to start a curl command in a minimized console.
this works:
START "" /B /W curl -X POST https://someurl.com -d "url_parameters_for_curl" > output.txt
But this does not work
START "" /MIN /W curl -X POST https://someurl.com -d "url_parameters_for_curl" > output.txt
I think it has something to do with the double quotes. I tried multiple escaping characters like ^ or "" and triple """ which worked for some other programs but START does not seem to be able to escape the double quotes when opening a new console window...
I've spent like 2 hours now trying to figure this out and I have no idea what to do.
PS: putting the command in a .bat file and calling it with
START /MIN /W mybat.bat
is working. But the command is generated on the fly and I don't want to write a file each time.
PPS: the command is spawned by a background process without a console window which leads to a console window popping up every time this happens. I just wanted it to appear minimized.
EDIT:
The hint with escaping the
> output.xml
with
^> output.xml OR ^>output.xml
did not work. But curl has an option to write the output to a file. So this finally worked:
START "" /MIN /W curl -X POST https://someurl.com -d "url_parameters_for_curl" -o output.txt
The question remains: How would you escape the "> outputfile" using the START command?
Upvotes: 0
Views: 119
Reputation: 38579
I would say, because curl.exe
is a CLI process, that it isn't cURL you need to minimize, but the cmd.exe
window it spawns to run within.
For that reason, I'd offer:
Start /Min /W %SystemRoot%\System32\cmd.exe /D/Q/C "%SystemRoot%\System32\curl.exe -X POST https://someurl.com -d "url_parameters_for_curl" 1> "output.txt" 2>&1"
In the example above, I've also redirected StdErr to the file, (because you wouldn't see that, in a minimized window). If you don't want that, you can remove 2>&1
from above.
Upvotes: 1