How to create a batch file to run cmd as administrator

前端 未结 12 2244
一个人的身影
一个人的身影 2020-12-04 19:43

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\".

12条回答
  •  情书的邮戳
    2020-12-04 20:03

    You might have to use another batch file first to launch the second with admin rights.

    In the first use

    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.

    You may have more luck with psexec.

提交回复
热议问题