[wpkg-users] %cd% in Batch File

Michael MacKay dmmackay at gmail.com
Thu Dec 22 02:32:04 CET 2011


Interesting,  I didn't know about  %~dp0  before.

To try another route,  just so I don't have to edit their batch files every
release, which are every other week it seems. Is it possible to map a drive
within WPKG for the term of the session?  Could I do a 'net use X:
\\unc\path'  and then run my batch from there?  That would probably allow
there patch to work unedited, but I haven't attempted to create a Mapped
Network Drive in a pre boot situation before (I am using the WPKG client,
not the script after logon).  Can I use the 'net use /persistent:no' and
have it drop the connection when done?

Thanks for the help.

On Wed, Dec 21, 2011 at 9:01 PM, Rainer Meier <r.meier at wpkg.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20111221/052fb827/attachment-0002.html>


More information about the wpkg-users mailing list