[tex-live] [off topic] question about a few details in windows bat files

T T t34www at googlemail.com
Wed Jan 26 18:01:44 CET 2011


On 26 January 2011 15:33, Lars Madsen <daleif at imf.au.dk> wrote:
> Hi, sorry for the off topic question

You will be forgiven this time ;)

> Now I'm wondering does anyone know why one need to use %~dp0 instead of
> %cd%?

These two do different things:  %~dp0 expands to the directory with
the currently executing script, while %cd% expands to the current
directory, which can be off course different.  BTW, I always do

  set cd=

before using %cd% to make sure it's not redefined.

> We simple do not understand why %cd% workes on most Windows laptops but not
> all.

One possibility is that someone started cmd.exe from the start menu
and then just typed the full path to the script.  Another possibility
is that the script was started from a non-mapped network
drive---cmd.exe doesn't allow the current directory to be an UNC path.

Cheers,

Tomek


More information about the tex-live mailing list