這篇文章主要講解了“bat腳本實(shí)現(xiàn)獲取指定幾個(gè)月前的月份信息”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“bat腳本實(shí)現(xiàn)獲取指定幾個(gè)月前的月份信息”吧!
@echo off rem 指定幾個(gè)月數(shù)前 set MonthsAgo=2 >"%temp%/DateCalculate.vbs" echo strLastDate=DateAdd("m", -%MonthsAgo%, Date) >>"%temp%/DateCalculate.vbs" echo strFmtDate=Right(Year(strLastDate),4) ^& Right("0" ^& Month(strLastDate),2) ^& "01" >>"%temp%/DateCalculate.vbs" echo WScript.Echo strFmtDate for /f %%a in ('cscript /nologo "%temp%/DateCalculate.vbs"') do ( set "DstDate=%%a" ) set DstDate=%DstDate:~0,4%%DstDate:~4,2% echo,%DstDate% pause
感謝各位的閱讀,以上就是“bat腳本實(shí)現(xiàn)獲取指定幾個(gè)月前的月份信息”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)bat腳本實(shí)現(xiàn)獲取指定幾個(gè)月前的月份信息這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!