Computing.Net > Forums > Programming > batch file problem with %homepath%

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file problem with %homepath%

Reply to Message Icon

Name: JoaoFig
Date: June 29, 2006 at 09:29:57 Pacific
OS: Windows XP Pro
CPU/Ram: 1.7GHz/1GB
Comment:

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
pause

returns, "File not found - *.*"

Any clues how to get it work on batch?



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: June 29, 2006 at 17:15:51 Pacific
Reply:

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...


0

Response Number 2
Name: JoaoFig
Date: June 30, 2006 at 07:05:51 Pacific
Reply:

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/c

on 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


0

Response Number 3
Name: JoaoFig
Date: June 30, 2006 at 07:13:19 Pacific
Reply:

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! ;)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


copy files of a particula... .bat check size of each f...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch file problem with %homepath%

Batch file problem with date www.computing.net/answers/programming/batch-file-problem-with-date/17190.html

Win XP batch file problem www.computing.net/answers/programming/win-xp-batch-file-problem/11239.html

Batch file problem www.computing.net/answers/programming/batch-file-problem/8964.html