0

I'm trying to create a small script that will allow me to copy folders and it's contents from a certain directory on my computer to another one. So far, here's what I have:

@echo off
SET /P %TARGET%=Enter variable name:
xcopy "C:\Folder1\%TARGET%" "C:\Folder2"
pause

It returns with INVALID PATH, 0 FILE(S) COPIED.

how would I need to alter the script to fix this?

1 Answer 1

1

dont use % when you declare the variable :

@echo off

SET /P TARGET=Enter variable name:

xcopy "C:\Folder1\%TARGET%\*.*" "C:\Folder2"

pause
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.