系统无法在文本文件中找到指定错误的文件

时间:2014-12-12 19:21:07

标签: windows batch-file cmd

我有一个包含ff:code

的文件名.txt
for /f "tokens=1" %%s in (C:\user\files\title.txt) do (
log normal "c:\user\user-log.txt"
)

现在我有一个调用names.txt的批处理文件。但是,它始终显示

The system cannot find the file specified.

如何解决此问题?是否可以在文本文件上安装批处理代码?

1 个答案:

答案 0 :(得分:0)

如上所述,您希望读取文件并将读取内容附加到另一个文件中。为此,您可以使用根据这些帖子的答案创建的以下脚本

Reading a text file line by line and storing it in an array using batch script

Append text with .bat

@echo off
set "file=F:\FileToReadFrom.txt"
set /A i=0

for /F "usebackq delims=" %%a in ("%file%") do (
set /A i+=1

call set array[%%i%%]=%%a
call set n=%%i%%
)

for /L %%i in (1,1,%n%) do call echo %%array[%%i]%%>> F:\AppendToFile.txt

以上代码您需要输入批处理文件,您还需要根据您的要求替换 FileToReadFrom.txt AppendToFile.txt 的路径。

如果这不是您想要的,请告诉我。