Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批处理文件查找一行并替换为内容_Batch File_Copy - Fatal编程技术网

Batch file 批处理文件查找一行并替换为内容

Batch file 批处理文件查找一行并替换为内容,batch-file,copy,Batch File,Copy,我已经看了好几篇文章,到目前为止还没有回答我的问题。我需要在一个配置文件中查找一个标记,在找到需要放置另一个文件的内容后,复制一个文件内容,并将数据粘贴到该标记所在的某一行。有什么想法吗?谢谢。试试这个: @echo off&setlocal set "searchtag=mytag" set "configfile=config.ini" set "file2=otherfile.txt" for /f "delims=" %%i in ('findstr /i "%searchta

我已经看了好几篇文章,到目前为止还没有回答我的问题。我需要在一个配置文件中查找一个标记,在找到需要放置另一个文件的内容后,复制一个文件内容,并将数据粘贴到该标记所在的某一行。有什么想法吗?谢谢。

试试这个:

@echo off&setlocal
set "searchtag=mytag"
set "configfile=config.ini"
set "file2=otherfile.txt"

for /f "delims=" %%i in ('findstr /i "%searchtag%" "%configfile%"') do (echo(%%i)>>"%file2%"

这个网站上的任何人都可以回答这个问题。你能提供更多的细节吗。到目前为止你得到了什么?