gpt4 book ai didi

c# - 批处理文件获取语法错误

转载 作者:行者123 更新时间:2023-12-03 07:58:53 24 4
gpt4 key购买 nike

我正在尝试编写一个批处理文件,检查您的计算机名称是否为特定名称,然后与之匹配的exe文件将运行。

@echo off

echo adidas shoe cop bot console...
echo by sam
pause

echo checking for computer name...

If %computername%=="DESKTOP-HQPDA76"
then echo %computername% found
echo user confirmed
echo starting file
pause
start /B "" "C:\Users\Sam Marriott\Desktop\Adidas Shoe Cop Bot\Package\Adidas Shoe Cop Bot\bin\Debug\Adidas Shoe Cop Bot.exe"
pause
Else NOT %computername%=="DESKTOP-HQPDA76"
then echo user access denied
pause

我收到有关此处未预期的(某些内容)错误或语法错误,但由于命令提示符关闭太快,我无法真正读取它。有什么帮助吗?

最佳答案

您的IF语句语法错误。尝试这个:

@echo off

echo adidas shoe cop bot console...
echo by sam
pause

echo checking for computer name...

if "%computername%"=="DESKTOP-HQPDA76" (
echo %computername% found
echo user confirmed
echo starting file
pause
start /B "" "C:\Users\Sam Marriott\Desktop\Adidas Shoe Cop Bot\Package\Adidas Shoe Cop Bot\bin\Debug\Adidas Shoe Cop Bot.exe"
pause
) else (
echo user access denied
pause
)

关于c# - 批处理文件获取语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40383366/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com