我正在通過一個批處理檔案運行一個數學公式來計算體積位移。我想對結果進行錯誤檢查以確保該值不是負數。但是,該值在選中時始終被視為正值。我相信這是批處理有限整數的結果。
我使用powershell進行計算。結果被放入 %result% 我也嘗試使用 powershell 來檢查 %result% 是否小于或等于 0,如果是則會出現 GOTO 錯誤。它只會導致崩潰。
有沒有人有什么建議?謝謝!
@echo off
echo.
title RAM Displacement Calculator
:Start
cls
color E0
set /p Bore=Enter RAM Chassis Diameter (Bore):
echo.
set /p Rod=Enter RAM Rod Diameter (Rod):
echo.
set /p Extended=Enter Fully Extended Length:
echo.
set /p Retracted=Enter Fully Retracted Length:
echo.
color E9
echo | set /p status=Cal
for /f "delims=" %%a in ('powershell -Command %Extended%-%Retracted%') do set A=%%a
echo | set /p status=c
echo | set /p status=u
for /f "delims=" %%a in ('powershell -Command %Bore%*%Bore%') do set B=%%a
echo | set /p status=l
echo | set /p status=a
for /f "delims=" %%a in ('powershell -Command %Rod%*%Rod%') do set C=%%a
echo | set /p status=t
echo | set /p status=i
for /f "delims=" %%a in ('powershell -Command %B%-%C%') do set BC=%%a
echo | set /p status=n
for /f "delims=" %%a in ('powershell -Command %A%*
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/520297.html
下一篇:用于回傳傳入變數的批處理腳本語法
