如何在Windows中运行具有管理员权限的批处理文件?

时间:2013-09-18 09:07:07

标签: ruby rake albacore

我正在使用Albacore,我想运行需要以管理员身份提升的批处理文件。 权利被检查为:

批处理文件:

AT > NUL
IF %ERRORLEVEL% NEQ 0 GOTO AdminRightError

:: more code here

:AdminRightError
ECHO You are not running as administrator!

Rake文件:

exec :CmdRunBatch do |cmd|
  cmd.command = "RunCommands.bat"
end

当我通过普通(非提升)命令行执行rake CmdRunBatch时,我得到批处理文件中描述的AdminRightError。有没有办法解决这个问题?

0 个答案:

没有答案
相关问题