curl change path of download to dynamically
I want to make a batch so it can download files to a desktop folder for anyone who clicks on it
this is the static code
curl --output C:\Users\admin\Desktop\stuff/file.zip --url https://wordpress.org/latest.zip
I want to make it dynamic - the path changing depend on the pc
Solution 1:
I want to make it dynamic - the path changing depend on the pc
I presume by "dynamic" you want the path to refer to the user running the batch file?
In that case replace C:\Users\admin
with the System environment variable %USERPROFILE%
.
curl --output %USERPROFILE%\Desktop\stuff\file.zip --url https://wordpress.org/latest.zip
You need to make sure the directory Desktop\stuff
exists otherwise create it.
Further Reading
- An A-Z Index of the Windows CMD command line | SS64.com
- Windows CMD Commands (categorized) - Windows CMD - SS64.com
- Windows Environment Variables - Windows CMD - SS64.com