Reyesrj
asked on
Batch Script .bat
Hi All,
I have a script that when I try to run it, it closes at this point:
1. FOR /f %a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%a
2. SET NowStamp=%DTS:~0,4%-%DTS:~ 4,2%-%DTS: ~6,2%_%DTS :~8,2%-%DT S:~10,2%-% DTS:~12,2%
3. robocopy "C:\Users\richa\Google Drive" /MIR F:\1BackUp\GoogleDrive_%No wStamp%
I'm trying to backup my files at 6pm, when I'm gone for the day. It will create a backup copy and append the current time and date at the end of the folder name. Each line will run in the command window. It just won't run if I create a .cmd or .bat script.
Please help with this problem or suggest an alternative solution.
Thank you in advance.
I'm using a windows 10 workstation.
I have a script that when I try to run it, it closes at this point:
1. FOR /f %a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%a
2. SET NowStamp=%DTS:~0,4%-%DTS:~
3. robocopy "C:\Users\richa\Google Drive" /MIR F:\1BackUp\GoogleDrive_%No
I'm trying to backup my files at 6pm, when I'm gone for the day. It will create a backup copy and append the current time and date at the end of the folder name. Each line will run in the command window. It just won't run if I create a .cmd or .bat script.
Please help with this problem or suggest an alternative solution.
Thank you in advance.
I'm using a windows 10 workstation.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Works Perfect now!
Glad to help.
Open in new window