|
Answer» got a PROBLEM in copying a file from one path to another path with a 'VARIABLE folder name' in the path
The following code WORKS fine if the folder name doesnot have a space in it.(hear Folder1 is the variable folder name)
CODE:
@echo off&setlocal enabledelayedexpansion
SET inpu="Folder1" ::SET /p fil=enter file name:
for /F "delims=" %%x in ('dir "C:\Users\kumark3\Desktop\"%inpu% /ad /b') do ( set /a userslen+=1 set "usersarray!userslen!=C:\Users\kumark3\Desktop\%inpu%\%%x" )
for /l %%x in (1,1,%userslen%) do (
xcopy "!usersarray%%x!\geth\gr.txt" "C:\Users\kumark3\Desktop\Folder2" /c /h /r /y /i
)
But if the folder name has a space, the code is not working for eg if the 2nd line in the code is like
SET inpu="Folder 1"
Please give me a solution for this problemPlease Tell ME Are you Trying To Auto Increment The Folder On Copy?
And dont add @echo off&setlocal enabledelayedexpansion USE @echo off ONLY!!
|