On Win7 64 Pro, I have a batch file that runs net use to map a network share from my server over OpenVPN.

The batch file doesn't have the username or password stored in it, it uses the user credentials that I have already saved by running net use once with the /savecred flag in a command prompt.

If I double click the batch file to run it, it executes fine, no problems.

However, if I schedule a task to run the batch file, the execution pauses and asks for username and password.

Is there any way to force the scheduled task to use the saved user credentials?


To solve this issue I ended up putting the batch file into the startup folder of the start menu. For some reason it uses the saved credentials when run from here but doesn't when run on startup with the task scheduler.

To make sure the VPN connection was up before running the batch file I used timeout 30 to delay execution of the batch file until OpenVPN had done its thing.

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.