[英]Copy data From one file to another file doesn't work (Batch Script)
First I read the path from another file and stored it into "c" variable But Path contains by "C" variable has space like ~~~ E:\\my folder\\first.txt首先,我从另一个文件中读取路径并将其存储到“c”变量中,但是“C”变量包含的路径具有像~~~ E:\\my folder\\first.txt 这样的空间
When I try batch script to copy data from one file(file path specified by c variable) into another file, it doesn't work当我尝试批处理脚本将数据从一个文件(由 c 变量指定的文件路径)复制到另一个文件时,它不起作用
COPY %c% E:\shubham\second.txt
I also tried with double quotes:我也试过用双引号:
COPY "%c%" "E:\shubham\second.txt"
doesn't work不起作用
Here is the full Script:这是完整的脚本:
@echo on SetLocal EnableDelayedExpansion
for /F "delims=" %%i in (E:\WritePath.txt) do set c=!content! %%i echo %c% COPY %c% E:\shubham\second.txt
You are not setting the variable correctly.您没有正确设置变量。 it should be set c=%%i
它应该set c=%%i
but you do not need to set the variables here, you can use the metavariable as is.但是您不需要在此处设置变量,您可以按原样使用元变量。
@echo off
Setlocal enabledelayedexpansion
for /F "delims=" %%a in (E:\WritePath.txt) (
Set var=!var! %%a
echo !var!
)
echo !var! >>"E:\shubham\second.txt"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.