Batch file PowerShell语法错误,未编译

Batch file PowerShell语法错误,未编译,batch-file,Batch File,我删掉了systeminfo部分,以加快运行速度,这样你就可以看到我上面的评论的意思。我还删除了不太可能看到的额外输出 @echo off cls systeminfo | find /i "System Type" | find /i "X86-based PC" if %errorlevel% == 0 set spth="C:\Program Files\Shoreline Communications\ShoreWare Client\Shoretel.exe" Echo Checkin

我删掉了systeminfo部分,以加快运行速度,这样你就可以看到我上面的评论的意思。我还删除了不太可能看到的额外输出

@echo off
cls
systeminfo | find /i "System Type" | find /i "X86-based PC"
if %errorlevel% == 0 set spth="C:\Program Files\Shoreline Communications\ShoreWare Client\Shoretel.exe"
Echo Checking System Type (x86 vs x64)
systeminfo | find /i "System Type" | find /i "X64-based PC"
if %errorlevel% == 0 set spth="C:\Program Files (x86)\Shoreline Communications\ShoreWare Client\Shoretel.exe"

Echo Checking if Communicator is already installed.....
if exist %spth% goto end1
if NOT exist %spth% goto install

:install
echo Installing Shoretel Communicator
\\cupe-fs-1\apps\ShortelConnect\install-win\GPO\setup.exe /S /v"/qn REBOOT=reallysuppress"
echo Installation Finished
exit

:end1
echo Shoretel Communicator is already installed.
ping 127.0.0.1 -n 5 > nul
exit

该代码不是powershell,它是一个bat脚本(并且似乎没有调用powershell)。您正在尝试将此脚本作为powershell脚本调用吗?是的,zdan!我正在做一个实习,我应该帮助,但我太迷茫了,我觉得有些代码甚至没有()和yeah。你能帮我完成这项工作吗?我会尽我最大的努力完成剩下的脚本。请帮我推一下!代码可以工作,尽管我可能会加快进程,而不是调用systeminfo。我认为@zdan试图告诉您的是,您试图以错误的方式启动文件。如果我在cmd下开始这项工作,就不会有任何问题。是否要为此批处理脚本创建powershell脚本?
@echo off
cls
if exist "C:\Program Files\Shoreline Communications\ShoreWare Client\Shoretel.exe" goto end
if exist "C:\Program Files (x86)\Shoreline Communications\ShoreWare Client\Shoretel.exe" goto end

echo Installing Shoretel Communicator
\\cupe-fs-1\apps\ShortelConnect\install-win\GPO\setup.exe /S /v"/qn REBOOT=reallysuppress"

:end