dos bat, 建立今天日期資料夾

xcopy "C:\abc.txt" "D:\backup\"

好似上面依句咁
如果我唔想建立的資料夾係backup
而係今天的日期, 例如: 20090906

用dos的bat可以做到嗎?

據我所知, date /T呢個Command可以Output日期, 但係Format會係DD/MM/YYYY (可能各個地區的設置會唔同), 要點做Formatting就留俾其他巴打...

附加String substitution:
http://www.computing.net/answers ... titution/12097.html

[ 本帖最後由 GraphiteCube 於 2009-9-6 07:39 編輯 ]

TOP

呢度有個 info
http://www.netikka.net/tsneti/info/tscmd001.htm

唔識寫cmd batch, 睇吓幫唔幫到手?

TOP

Let me share my script to build folder and name it as date (YYYY-MM-DD), please help yourself:


FOR /F "tokens=1-4 delims=/ " %%a IN ("%date%") DO SET CUR-DRB=%%a-%%b-%%c


md D:\%CUR-DRB%

TOP

原帖由 login 於 2009-9-6 13:01 發表
Let me share my script to build folder and name it as date (YYYY-MM-DD), please help yourself:


FOR /F "tokens=1-4 delims=/ " %%a IN ("%date%") DO SET CUR-DRB=%%a-%%b-%%c


md D:\%CUR-DRB%


得左,又學到野啦,thx for sharing

TOP

原帖由 login 於 2009-9-6 13:01 發表
Let me share my script to build folder and name it as date (YYYY-MM-DD), please help yourself:


FOR /F "tokens=1-4 delims=/ " %%a IN ("%date%") DO SET CUR-DRB=%%a-%%b-%%c


md D:\%CUR-DRB%


我在你講完之後才知道原來dos可以直接行程式碼
咁我想問dos可以行邊幾種程式碼的呢?

TOP