0
在DOS Windows批處理文件「在這個時候意外」,我收到以下錯誤:批處理文件錯誤,
45.0.31322.0 unexpected at this time.
的數字45.0.31322.0
是AgtVersion
變量的內容。
下面是代碼:
if agentVersion: 45.0.31322.0==agentVersion: 45.0.31322.0 set AgtVersion=45.0.31322.0
:: Identify HPSA Agent Version
for /f "delims=" %%x in ('get_info.bat ^| find /i "agentVersion: 4"') do @set hpsaAGT=%%x
:: Checks agent version and store in new variable
if %hpsaAGT%==agentVersion: 45.0.31322.0 set AgtVersion=45.0.31322.0
:: THE ERROR HAPPENS HERE:
:: the above line throws a: "45.0.31322.0 unexpected at this time."
if %hpsaAGT%==agentVersion: 40.0.0.1.106 set AgtVersion=40.0.0.1.106
if agentVersion: 45.0.31322.0==agentVersion: 45.0.31322.0 set AgtVersion=45.0.31322.0
:: Display HPSA Agent Version and store in txt file
echo %AgtVersion%> c:\temp\hpsa_agent\hpsaAGT.txt
echo Current HPSA Core : %AgtVersion%
這個錯誤是什麼消息呢?
使用雙引號,如果你的字符串包含空格:如果 「%hpsaAGT%」 == 「agentVersion:45.0.31322.0」 設置AgtVersion = 45.0.31322.0 – Stephan
可能[%x的重複在這個時候是意想不到的。批處理腳本](http://stackoverflow.com/questions/2190295/x-was-unexpected-at-this-time-batch-script) –