I am writing a batch file that would first look into a directory and check if the files that I specify are their. If not that look in another directory and xcopy them. This is the script I have:
@echo off
REM Makes a Folder on the U: drive
MD u:\Notes
c:
if Exist set a="Program files\lotus\notes\"(
xcopy C:\%a%\notes.ini U:\Notes\ /y /e
xcopy C:\%a%\Data\*.id U:\Notes\ /y /e
xcopy C:\%a%\Data\Desktop6.ndk U:\Notes\ /y /e
xcopy C:\%a%\Data\bookmark.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\names.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\Cache.NDK U:\Notes\ /y /e
)
Else set a= AppData\Local\Lotus\Notes\" (
xcopy C:\%a%\notes.ini U:\Notes\ /y /e
xcopy C:\%a%\Data\*.id U:\Notes\ /y /e
xcopy C:\%a%\Data\Desktop6.ndk U:\Notes\ /y /e
xcopy C:\%a%\Data\bookmark.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\names.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\Cache.NDK U:\Notes\ /y /e
)
@pause
2007-07-30
06:25:09
·
3 answers
·
asked by
Jessie S
1
in
Computers & Internet
➔ Programming & Design
The problem is, it does not work. Says files is not found and that
'Else' is not recognized as an internal or external command,
operable program or batch file.
2007-07-30
06:36:01 ·
update #1
I am even more confused. Let me see if I am getting this.
If I were to do this:
if set a=Program files\lotus\notes goto if set a=Program files\lotus\notes (
xcopy C:\%a%\notes.ini U:\Notes\ /y /e
xcopy C:\%a%\Data\*.id U:\Notes\ /y /e
xcopy C:\%a%\Data\Desktop6.ndk U:\Notes\ /y /e
xcopy C:\%a%\Data\bookmark.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\names.nsf U:\Notes\ /y /e
xcopy C:\%a%\Data\Cache.NDK U:\Notes\ /y /e
)
echo this is the if part
REM echo this is the else part
goto after
xcopy C:\Doucment and Settings\%username%\Local Settings\Application Data\Lotus\Notes\Data\notes.ini U:\Notes\ /y /e
xcopy C:\Doucment and Settings\%username%\Local Settings\Application Data\Lotus\Notes\Data\*.id U:\Notes\ /y /e
xcopy C:\Doucment and Settings\%username%\Local Settings\Application Data\Lotus\Notes\Data\Desktop6.ndk U:\Notes\ /y /e
xcopy C:\Doucment and Settings\%username%\Local Setti
2007-07-31
02:44:57 ·
update #2