Using a Batch For backing up a directory (Chrome). I'm using the native Windows Schedule Task Manager to ping, run the file (working great). However, if I go to bed (forgetting to shut down Chrome), naturally I don't get a full backup.
Therefore, I added the
else if, however if I do shut down Chrome, the file runs, but it's rather "Dirty". How can I add an "if not"? Do I nest it inside the
Here's what I'm running, again it works (regardless of if Chrome is shut down or not), but not "clean". I would like to make it clean, i.e. by showing an error like "Chrome does not Exist".
IF EXIST CHROME COMMAND ( set drive=C: echo ### Killing Chrome Task taskkill /F /IM chrome.exe /T PING 220.127.116.11 -n 1 -w 60000 >NUL ) ELSE ( :: variables set drive=E:\BrowserBackups\Chrome set folder=%DATE:~4,2%_%DATE:~7,2%_%DATE:~10,4%_%RANDOM% set backupcmd=xcopy /C/E/H/I/R/K/Y echo ### Backing up directory... %backupcmd% "%USERPROFILE%\Local Settings\Application Data\Google\Chrome" "%drive%\%folder%" ) pause
Not sure where to put the "IF NOT EXISTS" command.