Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
i'm trying to backup several directories to another drive, i need the code to work on 5 different pc's so the %homepath% system variable really comes in handy.
The problem is the same code that works smoothly on the cmd line, gives an error while used on batch, in every line the %homepath% variable is used.
Example:echo off
xcopy "%HomePath%\Favorites\*.*" "D:\Other\" /s/r/y/c
pausereturns, "File not found - *.*"
Any clues how to get it work on batch?

check the value of your %homepath%
it should be \somepath . There is no drive letter assigned.
guess you should do something like
xcopy %driveletter%homepath% blah blah...

I think the value of my %homepath% is ok. When i write %homepath% on MSexplorer path it returns C:\Documents and Settings\MyName\
and when i use,
xcopy "%HomePath%\Favorites\*.*" "D:\Other\" /s/r/y/con the cmd line it works perfectly, problem is when i use the same code on the batch file, and then run the .bat it returns "File not found - *.*" on every line i use the %homepath% variable, though a simpler xcopy like,
xcopy c:\*.txt d:\temp /s/q
works flawless. How should i get it to work on batch?
Thanks

Afterall your sugestion solved my problem, i only needed to add c:%homepath% on the batch file, though on the cmd line %homepath% would suffice.I'm really sorry for the double post. Thanks again! ;)

![]() |
copy files of a particula...
|
.bat check size of each f...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |