本帖最后由 m91opse 于 2018-5-18 22:54 编辑
- @echo off&setlocal enabledelayedexpansion
-
- set y1=100
- set y2=
- set y3=
- set y4=
- set y5=
- set y6=
- set y7=
- set y8=
- set y9=
- set y10=
- set y11=
- set y12=
-
-
- for %%a in (%y1% %y2% %y3% %y4% %y5% %y6% %y7%
- %y8% %y9% %y10% %y11% %y12%) do if "%%a" neq "" (
- if not defined sum ( set "sum=%%a" ) else (
- set "sum=!sum!+%%a"
- )
- )
- for /f %%a in ('powershell -c "%sum%"') do set sum=%%a
-
- echo ==============================================
-
- echo 2017年盈亏情况= %sum%元
-
- echo ==============================================
-
- >>j.txt echo ==============================================
- >>j.txt echo 2017年盈亏情况= %sum%元
- >>j.txt echo ==============================================
-
- pause
复制代码
|