troubleshooting Question

Command-line Script

Avatar of sglee
sglee asked on
Windows BatchMicrosoft DOSWindows OS
15 Comments3 Solutions250 ViewsLast Modified:
Hi,
  I currently have .BAT files (that run at scheduled time in Task Scheduler) and they backs up files and folders from the Server to the shared folder off the workstation PC. I have five .BAT files like below.

   Monday.bat
    Robocopy C:\Data      \\frontdesk2\ServerBackup\Mon\Data            /MIR /W:0 /R:0

  Tuesday.bat
    Robocopy C:\Data      \\frontdesk2\ServerBackup\Tue\Data            /MIR /W:0 /R:0

  Friday.bat
    Robocopy C:\Data      \\frontdesk2\ServerBackup\Fri\Data            /MIR /W:0 /R:0

  I like to be able to combine all these batch files into one by writing a script like below and have just one in TaskSchd.msc.

  If today is Monday then
    Robocopy C:\Data      \\frontdesk2\ServerBackup\Mon\Data            /MIR /W:0 /R:0
  else if today is Tuesday then
      Robocopy C:\Data      \\frontdesk2\ServerBackup\Tue\Data            /MIR /W:0 /R:0
   else if today is Friday
    Robocopy C:\Data      \\frontdesk2\ServerBackup\Fri\Data            /MIR /W:0 /R:0
endif

Is it possible?
ASKER CERTIFIED SOLUTION
NVIT
End-user support

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 3 Answers and 15 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 3 Answers and 15 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004