4

I want to Copy/Move files in Windows XP from Desktop(a Folder) to My Document(another Folder), which was created by same Batch File on Current Date in Format DD/MM/YYYY.

This is working fine when .BAT File is in Desktop Folder.

@echo off
set date="%date:~7,2%-%date:~4,2%-%date:~10,4%"
mkdir %date%
copy *.txt \%date%
pause

Now what this .BAT is doing is, creating Folder 18-01-2013 on Desktop and coping all .TXT files in this Folder.

But this is not working,

@echo off
set date="%date:~7,2%-%date:~4,2%-%date:~10,4%"
mkdir %USERPROFILE%\My Documents\%date%
copy %USERPROFILE%\desktop\*.txt %USERPROFILE%\My Documents\%date%
pause

This .BAT File is creating these folders; 1. In C Drive>Documents 2. On Desktop (and, Chandel>My, Documents>18-01-2013, Settings>Anshuman)

Any help in this regard is highly appreciated!

1 Answer 1

6

Try putting lines that has file/folder names with spaces in quotes e.g. update this line

mkdir %USERPROFILE%\My Documents\%date%

to

mkdir "%USERPROFILE%\My Documents\%date%"
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.