[wpkg-users] %cd% in Batch File
Rainer Meier
r.meier at wpkg.org
Thu Dec 22 02:01:09 CET 2011
Hi Michael,
On 21.12.2011 23:01, Michael MacKay wrote:
> I am trying to deploy a patch for some custom software supplied by our parent
> company. They send it as an .exe (no silent option), which I extract it, it is
> basically a batch scripted update. I can run the batch file on a workstation and
> it works but running into problems running it via WPKG. It is a 200+ line batch
> file but I believe the issue has to do with the %cd% (current directory)
> variable. Early in the script it has this:
>
> set CURDIR="%cd%"
[...]
%COMSPEC% (cmd.exe) does not support running from an UNC path as the working
directory. If a *.cmd script is run from UNC path as with WPKG
(\\server\path\script.cmd) then the working directory is set to some local path.
Try the following instead:
set CURDIR=%~dp0
This will set CURDIR to the drive and path of the script the term is used
within. It supports UNC paths.
So if the script using %~dp0 is located at \\server\share\path\script.cmd then
CURDIR will be set to \\server\share\path\
br,
Rainer
More information about the wpkg-users
mailing list