I need users to be able to copy a folder on a network share to another folder on the same share. They need to copy security too. They cannot use their normal logged in account as it doesn't have enough permissions (the folder is a "template" folder and is locked down with restrictive NTFS security).

So I created a proxy account with full permissions and a batch file that calls runas like

runas /noprofile /env /user:proxyaccount@mydomain.com z:\copy_folder.cmd

copy_folder.cmd just contains a robocopy command to copy the folder.

The runas fails with "cannot find file copy_folder.cmd". Z: is mapped correctly and I have tried runas without the /noprofile and /env switches but I get the same error.

What syntax should I be using for runas to find copy_folder.cmd?


Network shares are not brought over as part of runas even with the /env switch. I would use the UNC path to the Z: drive mapping.

  • I second that. Always use a UNC path if possible. Drive mappings are a bit 20th century. – Tim Long Aug 5 '09 at 2:42

may be you need to map the Z: for proxyaccount beforehand


As I know runas supports specifying UNC path as a program argument. robocopy I guess will handle it too. So you can just use UNC path as Zypher suggested.

But how do you provide a password into that runas call? What triggers that routine? If you used /savecred to store the password then it stored within user's setting and you need to save it for each user. Even worse that the user can get this password in a plain text if he want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.