如何使用命令行为Windows打开提升的cmd? [英] How to open an elevated cmd using command line for Windows?

查看:210
本文介绍了如何使用命令行为Windows打开提升的cmd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用命令行在正常cmd上打开提升的命令提示符?

How do I open a elevated command prompt using command lines on a normal cmd?

例如,我使用 runas / username:admin cmd ,但是打开的cmd似乎没有提升!任何解决方案?

For example, I use runas /username:admin cmd but the cmd that was opened does not seem to be elevated! Any solutions?

推荐答案

我遇到了同样的问题,我能够打开CMD作为管理员从CMD的唯一​​方法是执行以下操作:

I ran into the same problem and the only way I was able to open the CMD as administrator from CMD was doing the following:


  1. 打开CMD

  2. 编写 powershell 并按 Enter

  3. CMD将进入powershell

  4. 处理cmd -Verb RunAs 并按 Enter

  5. 将出现一个弹出窗口,要求以管理员身份打开CMD

  1. Open CMD
  2. Write powershell and press Enter
  3. CMD will enter the powershell
  4. Write Start-Process cmd -Verb RunAs and press Enter
  5. A pop-up window will appear asking to open a CMD as administrator

编辑:
您也可以执行以下命令行:

You can execute the following command line too:

powershell.exe -CommandStart-Process cmd -Verb RunAs

在你的设置。这具有可以从可以运行.exe(使用CreateProcess API)的程序运行的优点,例如cmd,powershell或任何你创建的。

It will put up a UAC dialog dependent upon your setting. This has the advantage that it can be run from and program that can execute an .exe (using the CreateProcess API), such as cmd, powershell or any that you create.

这篇关于如何使用命令行为Windows打开提升的cmd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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