达到最大setlocal递归级别

时间:2018-02-19 11:35:59

标签: batch-file

虽然我正在努力学习并为我的项目完成自动化批处理脚本,但我对编码非常非常新手。所以下面的代码是完美无缺的,但过了一段时间我就得到了

“达到最大setlocal递归级别”

错误,它回声不变!行!但只有“!行!”到我的csv文件。我已经搜索了很多关于这个并阅读了很多问题并尝试了解决方案,但无法设法修复它。所以,如果有人可以提供帮助,我真的很感激。

我的主要info.csv文件有超过130行。请注意,我在超时%wait%

后再次调用同一个bat
echo off

(
  for /f "tokens=1-3 delims=," %%a in (info.csv) do @echo(%%~c,%%~a,%%~b)|sort|for /f "tokens=1* delims=," %%a in ('findstr "^"') do @echo(%%~b,%%~a>> ordered.csv

for /f "tokens=1-3" %%a in (ordered.csv) do echo %%~a%%~b%%~c >>ordered2.csv

(   For /F "UseBackQ Tokens=1-3 Delims=," %%A In ("ordered2.csv") Do (
        if %%C LSS %totalsec% echo %%~A,%%~B,%%~C>> info1.csv

        if %%C GTR %totalsec% echo %%~A,%%~B,%%~C>> notyet1.csv))

@echo off & setlocal

rem // redirect output to new csv file
>"info2.csv" (

    rem // get each line from the old csv file
    for /f "usebackq delims=" %%I in ("info1.csv") do (
        set "line=%%I"

        rem // get the last column (max 20 columns)
        call set "last=%%line:*,=%%"
        for /L %%# in (1,1,19) do call set "last=%%last:*,=%%"

        rem // remove spaces in last column and reassemble line
        call call set "line=%%%%line:%%last%%=%%last: =%%%%%%"

        rem // output result
        setlocal enabledelayedexpansion
        echo(!line!
        endlocal
    )
)       

@echo off & setlocal

rem // redirect output to new csv file
>"notyet.csv" (

    rem // get each line from the old csv file
    for /f "usebackq delims=" %%I in ("notyet1.csv") do (
        set "line=%%I"

        rem // get the last column (max 20 columns)
        call set "last=%%line:*,=%%"
        for /L %%# in (1,1,19) do call set "last=%%last:*,=%%"

        rem // remove spaces in last column and reassemble line
        call call set "line=%%%%line:%%last%%=%%last: =%%%%%%"

        rem // output result
        setlocal enabledelayedexpansion
        echo(!line!
        endlocal
    )
)


setlocal enabledelayedexpansion
set "cmd=findstr /R /N "^^" info2.csv | find /C ":""
for /f %%a in ('!cmd!') do set max=%%a
set /a maxx = %max% + 1
echo Total: %max%

echo var i; >> timecheck.js
echo for (i = 1; i ^< %maxx%; i++) { >> timecheck.js
echo iimSet("loop", i); >> timecheck.js
echo iimPlay("timecheck"); >> timecheck.js
echo } >> timecheck.js
endlocal


for /F "tokens=2" %%i in ('date /t') do set mydate=%%i
set mytime=%time%
SET /A wait=%RANDOM% * 100 / 120768 + 1
if %wait% LSS 5 set /a wait = %wait% + 5
if %wait% GTR 25 set /a wait = %wait% - 5
set /a wait = %wait% * 60
set /a second=%RANDOM% * 100 / 55768 + 1
set /a wait = %wait% + %second%
set /a wait = %wait% / 60

timeout %wait%
1.bat

0 个答案:

没有答案