Celeb Glow
updates | March 10, 2026

What's the difference between runas.exe and "Run as different user"?

I'm working with a line-of-business application that needs to be run as a domain user. I have a user that wants to continue using a local account (since not everything can be migrated to a domain user profile), though the computer is domain-joined, so I set up a shortcut that launches a batch file which uses runas.exe, which prompts the user for his domain password. The full batch file looks like this:

cd \path\to\app
whoami | findstr /i "domain\\"
if errorlevel 1 ( runas /user:domain\domuser \path\to\app\app.exe
) else ( app.exe
)

(Essentially, it only does runas if the user is not currently logged in as a domain user.) I'm not using any other switches on runas, but when I try them, /noprofile and /env don't seem to do anything.

This application launches and displays its initial screen after putting a password into runas. (If it's run as a local user, it throws a failure dialog, and that's not happening here.) However, the application then proceeds to misbehave. The bizarre part is that it works fine if I Shift+right-click it (either that shortcut or the EXE itself) and do the "Run as different user" thing.

I do not have access to this program's source, nor am I at liberty to discuss specifics of it. That's beside the point, though - what's different between launching it with runas and "Run as different user"?

This is 64-bit Windows 10 Pro, though I also see this problem on Windows 8.1 Pro.

1

1 Answer

After some experimentation, I noticed that runas.exe always sets the program's startup directory to System32, while Run as different user sets the starting directing to the folder containing the EXE.

Proof

This can be demonstrated by creating a batch file that contains something like:

echo %cd%
pause

Place it in a folder accessible to all users. If you run it just by double-clicking it in File Explorer, it will show the directory that contains it. It will do the same if you use Run as different user. If you open a Command Prompt window there and do runas /user:otheruser test.bat, it will fail ("no such file") if test.bat doesn't happen to be on the other user's or the system's PATH. That's because runas starts in System32. If you do runas /user:otheruser \full\path\to\test.bat, it will start, and display the path to System32, because that's its starting directory.

Fixing the problem

The program in question does strange things (but doesn't crash) if it doesn't see certain files in its current/starting directory. Update the batch file to use runas on a batch file that first cds to the right directory, then launches the program.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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