小编use*_*643的帖子

如何在批处理文件中增加txt文件中的值?

我一直在尝试编写一个批处理代码,该代码将:

  1. POST后自动执行。
  2. 增加一个代表 POST 数量的值。
  3. 保存、显示值并重新启动 PC。

我试图编写一个访问 txt 文件以获取该值的程序;但该值不会增加。

@echo off

echo.This script is counting the # of POSTs.

cd "C:\Users\HP-M6\Documents"
for /f "tokens=* delims=" %%x in (TEST.txt)  do echo %%x

call:myPOSTTest

for /f "tokens=* delims=" %%x in (TEST.txt)  do echo %%x

echo.&pause&goto:eof

::--------------------------------------------------------
::-- Function section starts below here
::--------------------------------------------------------
-- 
:myPOSTTest    - here starts my function identified by it's label

cd "C:\Users\HP-M6\Documents"

for /f "tokens=* delims=" %%x in (TEST.txt) do (

set %x%+=1

)

goto:eof
Run Code Online (Sandbox Code Playgroud)

batch-file

2
推荐指数
1
解决办法
8116
查看次数

标签 统计

batch-file ×1