代碼: 選擇全部
@FOR /F "tokens=1-3 delims=/ " %%a IN ("%date%") DO (SET _MyDate=%%a%%b%%c)
@FOR /f "tokens=1-2 delims=: " %%a in ("%time%") DO (set _Mytime=%%a%%b)
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISYS TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sqlSYS.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL01 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql01.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL06 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql06.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL07 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql07.bak'"