一個在windows 詢問帳號密碼的範例:
@echo off echo "Enter Username" set /p UserName= echo "Password" set /p PassWord= echo %UserName% %PassWord%
我改成如下:
autobackup.bat :
@echo off set today=%date:~0,4%%date:~5,2% echo %today% cd D:\dbbackup mkdir %today% Rem 每次手動執行會建立 例如201201的資料夾 echo "Username is root" Rem 已知ftp帳號為root echo "Enter Password.." set /p PassWord= Rem 在這邊會問密碼 echo root> script.txt echo %PassWord%>> script.txt echo bin>> script.txt echo lcd "D:\dbbackup\%today%">> script.txt echo cd "/exp_dump">> script.txt echo get "backup.log">> script.txt echo quit>> script.txt ftp -s:script.txt [server_ip]
沒有留言:
張貼留言