Eljefegeneo
Still trying to learn
- Local time
- Today, 05:26
- Joined
- Jan 10, 2011
- Messages
- 902
I have been trying to set up a batch file to allow users to copy the latest version of the front end whenever a change is made. The following is the code that I am trying to get to work properly. The first part works fine, the old front end is copied to a folder on the user's desktop as a backup. But I cannot get the copy of the server – the "P" drive, to overwrite the current copy on the user's desktop. Actually I cannot get the code to copy the new front end from the server and install it on the user's desktop. I think the path is correct for I seem to be able to run the new front end from the server.
When I look for the location on my computer, the server locations is listed as:
General (\\Servername\files) (P: ) (there is no space after the P: it seems to result in a smiley face when I type it and try to post it).
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
set TODAY=%year%-%month%-%day%
rem echo %TODAY%
for /f "tokens=1 delims=: " %%h in ('time /T') do set hour=%%h
for /f "tokens=2 delims=: " %%m in ('time /T') do set minutes=%%m
for /f "tokens=3 delims=: " %%a in ('time /T') do set ampm=%%a
set NOW=%hour%-%minutes%-%ampm%
rem echo %NOW%
rem copy the old front end to a folder on user's desktop named BackupDB
echo f | xcopy C:\Users\UserName\Desktop\DBMain.accdb C:\Users\UserName\Desktop\OldFE\%TODAY%-%NOW%_dbmain.accdb /f /i
rem copy the new front end to the user's desktop, overwrite the current front end
echo f | xcopy /f/y/ P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
rem start the new DB front end
Start c:\Users\UserName\Desktop\DBMain.accdb
This code works so I thought that the path was correct
rem this works
rem start the new DB front end
Start P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb
But this code does not.
echo f | xcopy /f/y/ P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
Neither does this:
echo f | xcopy /f/y/ \\ServerName\files\P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
Any help on this would be greatly appreciated.
When I look for the location on my computer, the server locations is listed as:
General (\\Servername\files) (P: ) (there is no space after the P: it seems to result in a smiley face when I type it and try to post it).
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
set TODAY=%year%-%month%-%day%
rem echo %TODAY%
for /f "tokens=1 delims=: " %%h in ('time /T') do set hour=%%h
for /f "tokens=2 delims=: " %%m in ('time /T') do set minutes=%%m
for /f "tokens=3 delims=: " %%a in ('time /T') do set ampm=%%a
set NOW=%hour%-%minutes%-%ampm%
rem echo %NOW%
rem copy the old front end to a folder on user's desktop named BackupDB
echo f | xcopy C:\Users\UserName\Desktop\DBMain.accdb C:\Users\UserName\Desktop\OldFE\%TODAY%-%NOW%_dbmain.accdb /f /i
rem copy the new front end to the user's desktop, overwrite the current front end
echo f | xcopy /f/y/ P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
rem start the new DB front end
Start c:\Users\UserName\Desktop\DBMain.accdb
This code works so I thought that the path was correct
rem this works
rem start the new DB front end
Start P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb
But this code does not.
echo f | xcopy /f/y/ P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
Neither does this:
echo f | xcopy /f/y/ \\ServerName\files\P:\AccessMainSplitBE\NewFrontEnd\DBMain.accdb c:\Users\UserName\Desktop\DBMain.accdb
Any help on this would be greatly appreciated.