I have to:
- Copy a .doc file from a location to another
- Rename it at the new location (adding the current date to the name)
- Open the location where the copied/renamed file is now located
- Play a confirmation sound
The (rudimentary) batch script below that relies on a small player (BP) to play the sound, works nicely for the 4 above points.
@echo off
xcopy "C:\Some Path\Doc.doc" "D:\My Documents\" /q /y /k /r /h
ren "D:\My Documents\Doc.doc" "New Word Document (%date%).doc"
ping -n 3 127.0.0.1 > nul
start "" /b /wait "D:\My Documents\"
BP /play /close /embedding .\1.wav
exit
I would like to ask somebody who (unlike me) is familiar with scripts to help me to add some IF statements, namely:
- Ref point 2 above: If the
"New Word Document (%date%).doc"
file already exists at that location, thexcopy
and theren
commands should be skipped (but the rest should continue).
and
- Ref point 3 above: If the folder
"D:\My Documents\"
is already open thestart
command should be skipped (but the rest should continue).
Thanks in advance for your kind help