I know when we add the >>
after echo
the output works but in the command line itself it's hidden. I'd like to know if there is a way I can do both without duplicating my code. So it should show in the command line and the output file.
Echo ### Backing up Drivers >> %Drive%:\Backup\Backup-Log.txt
Ping 127.0.0.1 >nul
xcopy "%HOMEDRIVE%\drivers" /c /d /h /e /i /y "%Drive%:\Backup\Drivers" >> %Drive%:\Backup\Backup-Log.txt
echo ### Backing up the Registry... >> %Drive%:\Backup\Backup-Log.txt
if not exist "%Drive%\Registry" mkdir "%Drive%:\Backup\Registry"
if exist "%Drive%\Registry\regbackup.reg" Echo "Replacing %Drive%:\Backup\Registry\regbackup.reg" >> %Drive%:\Backup\Backup-Log.txt
if exist "%Drive%\Registry\regbackup.reg" del "%Drive%:\Backup\Registry\regbackup.reg" >> %Drive%:\Backup\Backup-Log.txt
regedit /c /d /h /e /i /y "%Drive%:\Backup\Registry\regbackup.reg" >> %Drive%:\Backup\Backup-Log.txt