Link to home
Start Free TrialLog in
Avatar of jspade_69
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\applicationfolder\Office\

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
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can also just not use start ... If you are doing start / wait it isn't a lot different...

Steve
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
Avatar of oBdA
oBdA

"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.
oBdA... good point, sometimes better, sometimes the same.
Avatar of jspade_69

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