Tika9o9
Tika9o9

Reputation: 425

windows wget not downloading file but does in a browser

I'm trying to download a file using wget (the windows command line port) and I am getting this error..

--2016-12-06 12:36:11--  https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAdv064BIT/SQLEXPRADV_x64_ENU.exe
Resolving download.microsoft.com (download.microsoft.com)... 23.209.210.127
Connecting to download.microsoft.com (download.microsoft.com)|23.209.210.127|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-12-06 12:36:12 ERROR 404: Not Found.

Other files download fine using same commands...

here is what I have tried

"%~dp0wget" -c --show-progress --progress=bar:force:noscroll --no-check-certificate "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAdv%2064BIT/SQLEXPRADV_x64_ENU.exe" -P C:\Temp

..and..

"%~dp0wget" -c --show-progress --progress=bar:force:noscroll --no-check-certificate https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAdv%2064BIT/SQLEXPRADV_x64_ENU.exe -P C:\Temp

I was hoping it was a quotation issue to deal with the % in the link but no luck. I have tried single quotation marks also and put a \ infront of the % to escape the character.

Always the same error. I wonder if there is some server side restriction to a wget request on this site. Can I get round it? Perhaps I need some other switches? Thanks in advance.

Upvotes: 1

Views: 2652

Answers (1)

zb226
zb226

Reputation: 10500

Your commands work when simply run from cmd, but since you're running this from within a batch file, you need to escape the percent sign by doubling it, i.e.: %%%

That gives:

"%~dp0wget" -c --show-progress --progress=bar:force:noscroll --no-check-certificate "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAdv%%2064BIT/SQLEXPRADV_x64_ENU.exe" -P C:\Temp

To quote ss64.com:

Many characters such as \ = ( ) do not need to be escaped when they are used within a "quoted string" typically these are charcters you might find in a filename/path. The percent character is one exception to this rule, even though under NTFS % is a valid filename character.

Upvotes: 2

Related Questions