简体   繁体   中英

batch bitstransfer url with white spaces

I have a batch file. I use it to download installers (vlc.exe, VC++ 2008 redistributable package vcredist_x86.exe, etc) from web. Recently I downloaded VC++ 2008 redistributable package and it worked fine with this syntax:

Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%downloadPath%'

I set the VC++ 2008 download link in URL and C:\\Temp in downloadPath.

I have heard on other forums about using wget and curl but I would still like to use Start-BitsTransfer.

Now the problem is when I tried to download WAMP (from WAMP website which redirects to sourceforge.net website) using this same syntax I get the error

ERROR CODE: 0x80190194 - HTTP status 404: The requested URL does not exist

After much poking at the URL I saw that the WAMP download url has /WampServer%202/Wampserver%202.5/ (I guess for single white space). So when the Start-BitsTransfer executes this, I am guessing it some how messes up the url (I am not sure how).

Can someone tell me with example code how to download WAMP using this syntax Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%downloadPath%' Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%downloadPath%' ?

Or can someone tell me with example code how to download WAMP using PowerShell?

%用于扩展批处理文件语言中的变量,因此您必须通过将URL中的每个%加倍来对其进行转义:

/WampServer%%202/Wampserver%%202.5/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM