- Jul 15, 2005
- 729
- 0
- 76
So I just got a promotion at work and part of my new responsibilites will involve creating batch files for just about anything I can. We mainly use them to distro files out to retail stores worldwide.
Anyways, I just started editing and building batch files at home to build my skills. This is the first one I've built from scratch, but let me explain what I'm trying to do.
I have 2 computers at home and I am not very good at burning my CD's to both computers, mostly it's to my laptop, but my desktop has more HDD space so I'd like to use that as a backup. Eventually the desktop will become a media center so I want all my music on that PC. In my batch file, I want it to copy either My Music, My Pictures, or My Documents directories.
The problem I'm running into is accessing my desktop PC. It is named "office-desktop" and my laptop is called "Matt-laptop". Without further ado, here is my batch file.
btw, running Windows XP Pro SP3 on both PC's. I have installed choice.exe on both PC's as well. Again, my problem is accessing office-desktop from my laptop.
Thanks!
@echo off
:: ####################################################################
:: Created By: MATT NARDI
:: Version: 1.0
:: Created Date: 03 DEC 2009
:: Modified Date: 07 DEC 2009
:: Modified By:
:: Purpose: Select what folder to Copy contents of My Documents
####################################################################
title Copy My Documents
color 4f
CLS
echo.
:HOME
cls
echo What would you like to copy?
echo.
echo 1) Copy Music
echo 2) Copy Pictures
echo 3) Copy My Documents
echo 4) Exit
CHOICE /C:1234 /T:4,30 /N Please Make a Selection
if errorlevel 4 goto EXIT
if errorlevel 3 goto DOCUMENTS
if errorlevel 2 goto PICTURES
if errorlevel 1 goto MUSIC
:MUSIC
CHOICE /T:n,60 "Are you ready to copy music"
if errorlevel 2 goto HOME
echo Copying Music from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents\My Music" "\\office-desktop\C$\Documents
and Settings\Administrator\My Documents\My Music"
echo Process ran on: %computername%
pause
CLS
goto HOME
ICTURES
CHOICE /T:n,30 "Are you ready to copy Pictures"
if errorlevel 2 goto HOME
echo Copying My Pictures from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents\My Pictures"
"\\office-desktop\C$\Documents and Settings\Administrator\My Documents\My Pictures"
echo Process ran on: %computername%
pause
CLS
goto HOME
OCUMENTS
CHOICE /T:n,60 "Are you ready to copy My Documents"
if errorlevel 2 Goto HOME
echo Copying My Documents from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents" "\\office-desktop\C$\Documents and
Settings\Administrator\My Documents"
echo Process ran on: %computername%
pause
CLS
goto HOME
pause
:Exit
exit
Anyways, I just started editing and building batch files at home to build my skills. This is the first one I've built from scratch, but let me explain what I'm trying to do.
I have 2 computers at home and I am not very good at burning my CD's to both computers, mostly it's to my laptop, but my desktop has more HDD space so I'd like to use that as a backup. Eventually the desktop will become a media center so I want all my music on that PC. In my batch file, I want it to copy either My Music, My Pictures, or My Documents directories.
The problem I'm running into is accessing my desktop PC. It is named "office-desktop" and my laptop is called "Matt-laptop". Without further ado, here is my batch file.
btw, running Windows XP Pro SP3 on both PC's. I have installed choice.exe on both PC's as well. Again, my problem is accessing office-desktop from my laptop.
Thanks!
@echo off
:: ####################################################################
:: Created By: MATT NARDI
:: Version: 1.0
:: Created Date: 03 DEC 2009
:: Modified Date: 07 DEC 2009
:: Modified By:
:: Purpose: Select what folder to Copy contents of My Documents
####################################################################
title Copy My Documents
color 4f
CLS
echo.
:HOME
cls
echo What would you like to copy?
echo.
echo 1) Copy Music
echo 2) Copy Pictures
echo 3) Copy My Documents
echo 4) Exit
CHOICE /C:1234 /T:4,30 /N Please Make a Selection
if errorlevel 4 goto EXIT
if errorlevel 3 goto DOCUMENTS
if errorlevel 2 goto PICTURES
if errorlevel 1 goto MUSIC
:MUSIC
CHOICE /T:n,60 "Are you ready to copy music"
if errorlevel 2 goto HOME
echo Copying Music from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents\My Music" "\\office-desktop\C$\Documents
and Settings\Administrator\My Documents\My Music"
echo Process ran on: %computername%
pause
CLS
goto HOME
CHOICE /T:n,30 "Are you ready to copy Pictures"
if errorlevel 2 goto HOME
echo Copying My Pictures from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents\My Pictures"
"\\office-desktop\C$\Documents and Settings\Administrator\My Documents\My Pictures"
echo Process ran on: %computername%
pause
CLS
goto HOME
CHOICE /T:n,60 "Are you ready to copy My Documents"
if errorlevel 2 Goto HOME
echo Copying My Documents from Laptop to PC
xcopy /H /C /S /D /-Y "C:\Documents and Settings\Matt Nardi\My Documents" "\\office-desktop\C$\Documents and
Settings\Administrator\My Documents"
echo Process ran on: %computername%
pause
CLS
goto HOME
pause
:Exit
exit