我尝试了批处理文件菜单选项,单击批处理文件图标后会提示输入管理员密码。但我注意到菜单选项上应该在 Chrome 上打开多个网站,但它不起作用。我尝试更改为 MS Edge,但它似乎只能检测到我包含在列表中的前 2 个网站。
我认为这是因为我在管理员权限下运行,它以管理员权限启动了 Chrome,搞砸了,如果我运行 bat 文件而没有启动管理员登录窗口的脚本的上半部分,它对网站来说运行正常。有没有办法可以以非管理员帐户启动 Chrome,然后将其添加到我的脚本中?
下面是我所做工作的一个例子。
我的管理窗口脚本的上部如下:(我使用下面的管理提示命令,因为我注意到它无法读取我保存为 .txt 文件的文本图像,如果我右键单击以管理员身份运行 - 有人可以帮忙解释一下原因吗?
::::::::::::: Automatically check & get admin rights V2 ::::::::::::
@echo off
Color A
CLS
ECHO.
ECHO
====== You're Running Admin Mode! ======
:init
setlocal DisableDelayedExpansion
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO
*** Invoking UAC for Privilege Escalation *****
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & pushd
cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
#And below is a part of the Menu options where it launches the websites:
:Launch Daily Websites on Chrome
start chrome https://www.bluematrix.com/www3/CreatorLogin.action
start chrome https://www.citrix.com/
start chrome http://creditmatch.gfigroup.com/asia
ECHO.
PAUSE
GOTO MAIN MENU
CLS