views:

1434

answers:

2

I'm trying to run the program I'm debugging as a different user. Now, this can be done by running the exe and attaching from Visual Studio, but this is cumbersome.

What I've tried to do is use the "RunAs" command:

command.com /C runas /env /user:OtherUser DebugTarget.Exe

But this is attached to command.com, Visual Studio wants an exe. Now I can create a dummy app....but anyone have a better solution for this?

+4  A: 

This works (I feel so idiotic):

C:\Windows\System32\cmd.exe /C runas /savecred /user:OtherUser DebugTarget.Exe

The above command will ask for your password everytime, so for less frustration, you can use /savecred. You get asked only once. (but works only for Home Edition and Starter, I think)

moogs
How do you do this in Visual Studio? Do you open the solution, build and somehow run the above command from Visual Studio? I use VS2008.
Wallstreet Programmer
Got it, see http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/eeba26cb-2336-4a80-99f4-ca4167d0758c
Wallstreet Programmer
A: 

you can also use VSCommands 2010 to run as different user:

alt text

Registered User