SET INSTALLPATH problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
vipez21
Posts: 4
Joined: 30 Mar 2015 21:43

SET INSTALLPATH problem

#1 Post by vipez21 » 30 Mar 2015 21:54

I'm trying to create a batch file with that uses wget / nircmd.exe. i have install path set to "%appdata%"\whatever the problem comes when i run this batch file on my second computer which contains a space in the name of the user. wget seems to try and save it to c:\users\klaus and ends up writing a file called Klaus. when i need it to install to C:\Users\Klaus Schroder\AppData\Roaming\DriverPack

this is what i get, trying to figure out a way to make wget to save to directories with spaces as well as directories without spaces. does it not recognize the %appdata% as C:\Users\Klaus Schroder\AppData\Roaming\?

C:\Users\Klaus Schroder\AppData\Local\Temp>SET INSTALLPATH="C:\Users\Klaus Schro
der\AppData\Roaming"\DriverPack

C:\Users\Klaus Schroder\AppData\Local\Temp>mkdir "C:\Users\Klaus Schroder\AppDat
a\Roaming"\DriverPack

HTTP request sent, awaiting response... 200 OK
Length: 527960 (516K) [application/x-msdownload]
Saving to: 'C:/Users/Klaus'

C:/Users/Klaus 100%[=====================>] 515.59K 184KB/s in 2.8s

2015-03-30 22:47:03 (184 KB/s) - 'C:/Users/Klaus' saved [527960/527960]

--2015-03-30 22:47:03-- http://schroder%5Cappdata%5Croaming%5Cdriverpack%5Crar.
exe/
Resolving schroder\\appdata\\roaming\\driverpack\\rar.exe (schroder\\appdata\\ro
aming\\driverpack\\rar.exe)... failed: The requested name is valid, but no data
of the requested type was found. .
wget: unable to resolve host address 'schroder\\appdata\\roaming\\driverpack\\ra
r.exe'
FINISHED --2015-03-30 22:47:03--
Total wall clock time: 4.1s
Downloaded: 1 files, 516K in 2.8s (184 KB/s)

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: SET INSTALLPATH problem

#2 Post by foxidrive » 31 Mar 2015 02:18

You probably need double quotes in your wget command.

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: SET INSTALLPATH problem

#3 Post by Squashman » 31 Mar 2015 07:36

Neither of these commands have the double quotes in the correct position. You need to surround the WHOLE path with double quotes.
vipez21 wrote:C:\Users\Klaus Schroder\AppData\Local\Temp>SET INSTALLPATH="C:\Users\Klaus Schroder\AppData\Roaming"\DriverPack

C:\Users\Klaus Schroder\AppData\Local\Temp>mkdir "C:\Users\Klaus Schroder\AppData\Roaming"\DriverPack


I personally do not put quotes into the file path when I am assigning it to a variable. Just use quotes when you are executing the command.

Code: Select all

set installpath=C:\some path\with spaces\
mkdir "%installpath%"

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: SET INSTALLPATH problem

#4 Post by foxidrive » 31 Mar 2015 21:16

vipez21 wrote:SET INSTALLPATH="C:\Users\Klaus Schroder\AppData\Roaming"\DriverPack


Windows can handle some really strange methods of double quoting, such as the above too.
Some tools may fail - but most will work happily.

Squashman wrote:Just use quotes when you are executing the command.

Code: Select all

set installpath=C:\some path\with spaces\
mkdir "%installpath%"


True, except the set command should have double quotes around it all as shown below
- because an & in the path will break the set command without them. You know that, I'm just spelling it out for the OP.

set "installpath=C:\some path\with & and spaces\"

Post Reply