[wpkg-users] %cd% in Batch File

Rainer Meier r.meier at wpkg.org
Thu Dec 22 03:00:51 CET 2011


Hi Michael,

On 22.12.2011 02:32, Michael MacKay wrote:
> 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?

You can also define some pre-run scripts in WPKG client which can map some 
shares to drives and some post-run scripts to clean up the maps. However I 
strongly recommend not to go this way. It often causes issues (see very recent 
discussions on the list). Often users mix up contexts (WPKG run in SYSTEM 
context), and forget that automatically mapped shares like printers might 
already use up a user/password/share mapping triplet. You cannot map two 
different shares from the same server with different credentials.

Such things are hard to debug.

Moreover CMD scripts just run fine from UNC paths and most installers do as 
well. So I recommend not to map unnecessary drives and use full UNC paths 
instead (where %~dp0 is very handy).

br,
Rainer



More information about the wpkg-users mailing list