如何创建一个批处理文件来运行CMD以管理员身份 [英] How to create a batch file to run cmd as administrator
问题描述
我需要运行哪些需要注册一个DLL的批处理文件。该DLL注册失败,因为批处理文件没有启动命令提示符为管理员。
I need to run a batch file which needs to register a DLL. The DLL registration is failing because the Batch file is not starting the command prompt as "administrator".
有什么办法,启动命令提示符为管理员通过批处理文件。
Is there any way to start the "Command Prompt" as administrator through the batch file.
环境:Win7的/ Vista的
Environment: Win7/Vista
推荐答案
您可能需要使用另一个批处理文件率先推出第二个拥有管理员权限。
You might have to use another batch file first to launch the second with admin rights.
在第一次使用
runas /noprofile /user:mymachine\administrator yourbatchfile.bat
在进一步阅读,你必须能够在提示符下键入密码。你不能管密码此功能已锁定出于安全原因。
Upon further reading, you must be able to type in the password at the prompt. You cannot pipe the password as this feature was locked down for security reasons.
您可能有更多的运气 PSEXEC 。
这篇关于如何创建一个批处理文件来运行CMD以管理员身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!