When I map a shared folder to a drive in Explorer in Windows Server 2008 R2 the new drive letter (say Z:) does not work in cmd.exe (started as administrator).
What am I doing wrong?
I believe this only happens on systems where UAC is active.
You should map the drive from within your administrative CMD session instead, as it is using a different user context (the one of the administrative user obviously) and thus has no access to the environment of your "regular" user. From http://msdn.microsoft.com/en-us/library/windows/desktop/ms685143(v=vs.85).aspx :
to establish the mapping in your cmd session before executing whatever you want to be done with it.