1

I'm using a Win7 VM ith VMWare. I setup a shared folder to access some file of my host machine. Now I'm trying to access it through a batch script :

xcopy /y "Z:\Desktop\test\*" "C:\Users\%username%\Desktop\test\"

It's working when I launch the script normally, but not when executing it as admin..

Of course the rest of the script needs admin rights, that's why I execute this script as an admin.

I know that it is probably easy to fix but I didn't find how and I'm fed up to go round in circles..

Thanks !

  • Use UNC paths. Otherwise enable linked connections: http://woshub.com/how-to-access-mapped-network-drives-from-the-elevated-apps/. It’s been like this since Vista. – Appleoddity Jun 07 '19 at 12:10
  • Possible duplicate of [Command Prompt in Administrator mode doesn't see mapped drives](https://superuser.com/questions/690287/command-prompt-in-administrator-mode-doesnt-see-mapped-drives) – Appleoddity Jun 07 '19 at 12:11
  • 1
    also, if the user account you're on is not the one with admin privileges (i.e. UAC prompts you for your admin password), `%username%` will be something different (it's the username of the account running the script). – mael' Jun 07 '19 at 12:48
  • 1
    Possible duplicate of [Elevated command line prompt can't access shared drives](https://superuser.com/questions/199387/elevated-command-line-prompt-cant-access-shared-drives) – Worthwelle Jun 08 '19 at 02:37

0 Answers0