ok我正在尝试从我使用此脚本的文件中除去前两个字符。批处理文件中的Set命令中使用通配符
@echo off
Set "InputFile=C:\New Folder\test.txt"
Set "OutputFile=C:\New Folder\New\test.txt"
setLocal EnableDelayedExpansion > "%OutputFile%"
for /f "usebackq tokens=* delims= " %%a in ("%InputFile%") do (
set s=%%a
>> "%OutputFile%" echo.!s:~2!
)
如果我使用正确的名称,它会很完美。我需要做的是使用一个狂野的字符,因为每次文件的名称都是不同的。尝试此操作时不起作用。
@echo off
Set "InputFile=C:\New Folder\H*.txt"
Set "OutputFile=C:\New Folder\New\H*.txt"
setLocal EnableDelayedExpansion > "%OutputFile%"
for /f "usebackq tokens=* delims= " %%a in ("%InputFile%") do (
set s=%%a
>> "%OutputFile%" echo.!s:~2!
)
这将删除文件中每行的前两个字符。这是你想要的吗? – Stephan