jspade_69
asked on
Help running batchfile from network share with spaces in path
I have a batch file that runs from a network share....as long as the network share path doesn't have a space then the %~d0%~p0 function works beautifully.
Network path example Example:
\\servername\applicationfo lder\Offic e\
But if the paths has a space, then the function doesn't work:
Network path example 2:
\\servername\application folder\Office\
If I wrap the %~d0%~p0 in quotes like so - "%~d0%~p0" then it see the path, but I have a start /wait command before the exe and it's screws that up and the exe doesn't run it just opens up a second command window.
Example:
Start /wait "%~d0%~p0"
It will run without the start /wait but I need to have that to run other things in the batch file after the exe finishes.... can any one help?
Thanks
OfficeCleanInstall.txt
Network path example Example:
\\servername\applicationfo
But if the paths has a space, then the function doesn't work:
Network path example 2:
\\servername\application folder\Office\
If I wrap the %~d0%~p0 in quotes like so - "%~d0%~p0" then it see the path, but I have a start /wait command before the exe and it's screws that up and the exe doesn't run it just opens up a second command window.
Example:
Start /wait "%~d0%~p0"
It will run without the start /wait but I need to have that to run other things in the batch file after the exe finishes.... can any one help?
Thanks
OfficeCleanInstall.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW also if you don't know use
Pushd "%~dp0" and it will map a temporary drive if ran from a unc path so the current dir is the one the batch ran from.
Steve
Pushd "%~dp0" and it will map a temporary drive if ran from a unc path so the current dir is the one the batch ran from.
Steve
"start /wait" can be a lot different from just calling the program.
For example, if you invoke msiexec.exe from a batch without "start", msiexec will return immediately and run the install in the background (and obviously without returning an errorlevel).
Only "start /wait msiexec.exe ..." will actually wait until the installation is done and return an errorlevel.
For example, if you invoke msiexec.exe from a batch without "start", msiexec will return immediately and run the install in the background (and obviously without returning an errorlevel).
Only "start /wait msiexec.exe ..." will actually wait until the installation is done and return an errorlevel.
oBdA... good point, sometimes better, sometimes the same.
ASKER
Thanks guys....I ran it without the start /wait again and this time I was a bit more patient and it ran and continued on with the other steps in the batch file with no problem.
Thanks
Thanks
Steve