我看到过过多关于这个特定问题的不同帖子和解决方案,但出于某种原因,在实施了我遇到的几乎所有结果后,我仍然cannot find the path specific
令人抓狂的是,由于某种原因出现错误。
这是我的脚本:
@echo off
set "params=%*"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil ^
dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = ^
CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" ^
&& %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" ^
&& exit /B )
echo Running custom startup tasks...
pause
runas "/user:*domainname*\*username* /savecred ^
"C:\Program Files\EVGA\Precision X1" -s"
runas "/user:*domainname*\*username* /savecred ^
"M:\Google Drive\Personal\Computer & Tech\Fixes &" Scripts\AHK\Home.ahk"
runas "/user:*domainname*\*username* /savecred ^
"M:\Program Files (x86)\Steam\steam.exe""
runas "/user:*domainname*\*username* /savecred ^
"M:\Program Files\Rainmeter\Rainmeter.exe""
echo Done!
pause
exit
请注意,为了保护隐私,我已删除上面**内的部分。
答案1
尝试将用于提升你的蝙蝠的方法模式更改为以管理员身份运行。
这是一个简约的 vbs,可以帮助您阐明错误是出在 bat 还是 vbs 代码中。
尝试直接在命令行上逐个运行 bat 命令,以确保部分/会话是错误。
@echo off & setlocal EnableDelayedExpansion
title <nul & title ..\%~nx0 & "%__APPDIR__%mode.com" 122,30 & color 0a & cd /d "%~dp0"
2>nul "%__APPDIR__%whoami.exe" /groups | find "S-1-16-12288" >nul && goto :NXT: || <nul (
echo=CreateObject("Shell.Application"^).ShellExecute "%~sdpnx0", "%*", "RunAsAdministrator", "runas", 1: WScript.Quit
) >"%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" //nologo && 2>nul del /q /f "%temp%\getadmin.vbs" && goto :eof
:NXT:
echo=Running custom startup tasks... <nul || "%__APPDIR__%timeout.exe" /t 3 >nul & echo\
echo\runas /user:*domainname*\*username* /savecred "C:\Program Files\EVGA\Precision X1\PrecisionX_x64.exe" -s
echo\runas /user:*domainname*\*username* /savecred "M:\Google Drive\Personal\Computer & Tech\Fixes & Scripts\AHK\Home.ahk"
echo\runas /user:*domainname*\*username* /savecred "M:\Program Files (x86)\Steam\steam.exe"
echo\runas /user:*domainname*\*username* /savecred "M:\Program Files\Rainmeter\Rainmeter.exe"
echo\Done^!! & "%__APPDIR__%timeout.exe" /t 5 & endlocal & goto :EOF
- 这是未转义的vbs代码:
CreateObject("Shell.Application").ShellExecute "C:\Users\ecker\AppData\Local\Temp\Q1C765~1.CMD", "arg1 arg2 arg3", "RunAsAdministrator", "runas", 1: WScript.Quit
// Note: To hide/suppress the cmd window while executions are in progress, change: "runas", 1 to "runas", 0
答案2
使用以下行:
runas "/user:*domainname*\*username* /savecred ^
"C:\Program Files\EVGA\Precision X1" -s"
你正尝试在文件夹上“运行”,看起来好像你在末尾缺少一个可执行文件,这可能是下一行抛出错误“我仍然得到‘M:\Google’无法识别”的原因,前一个命令正在等待你告诉它要运行什么