在Visual Studio中调试时,运行方式为其他用户 [英] RunAs A different user when debugging in Visual Studio

查看:110
本文介绍了在Visual Studio中调试时,运行方式为其他用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以其他用户身份运行正在调试的程序.现在,可以通过运行exe并从Visual Studio附加附件来完成此操作,但这很麻烦.

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.

我试图做的是使用"RunAs"命令:

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

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

但这是附加到command.com的,Visual Studio需要一个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?

推荐答案

这有效(我觉得很蠢):

This works (I feel so idiotic):

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

上面的命令每次都会询问您的密码,因此为了减少沮丧,您可以使用/savecred.您只会被问到一次. (我认为,但仅适用于Home Edition和Starter)

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)

这篇关于在Visual Studio中调试时,运行方式为其他用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆