我有一个批处理文件,它运行几个进行表修改的python脚本.
我想让用户注释掉他们不想运行的1-2个python脚本,而不是从批处理文件中删除它们(所以下一个用户知道这些脚本作为选项存在!)
我还想添加注释,以便特别注意它们在运行之前需要在批处理文件中更新的变量.我明白我可以用了REM.但看起来更像是在用户运行后更新用户的进度.
是否有更适当添加评论的语法?
我的GOTO命令和附属标签有问题.
事实:鉴于来自文件夹的一堆文件(它们是日志错误),我需要打开它们并检查它们是否包含特定的字符串.如果是,则从文件名中删除一些字符(最后一次出现"_"后的所有字符,包括其自身)并执行其他操作.
为了切断字符,我正在循环使用GOTO命令,如我在此处所述:http://www.robvanderwoude.com/battech_while_loops.php
该脚本是:
@echo off
setlocal EnableDelayedExpansion
cls
for %%X in (D:\e-pub\outbox\logs\*.*) do (
for /F "tokens=7" %%S in (%%X) do (
if /i "%%S"=="<ml>" (
SET fisier=%%~nX
SET cond=!fisier:~-1!
SET fisier=!fisier:~0,-1!
:loopStart
rem condition to break the loop
if !cond!==_ goto loopEnd
SET cond=!fisier:~-1!
SET fisier=!fisier:~0,-1!
goto loopStart
:loopEnd
rem here it should be out of a loop
rem other stuff to do with var !fisier!
rem the following line is not executed because of …Run Code Online (Sandbox Code Playgroud) batch-file ×3
comments ×2
cmd ×1
coding-style ×1
command ×1
commenting ×1
file ×1
goto ×1
windows ×1