If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
rename file tgrough bat file
dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt
in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. |
Ads |
#2
|
|||
|
|||
rename file tgrough bat file
"Natalia" wrote in message ... dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. It depends on your date format. Click Start / Run / cmd {OK}, then type this command: echo %date%{Enter} What do you see? |
#3
|
|||
|
|||
rename file tgrough bat file
"Pegasus (MVP)" wrote: "Natalia" wrote in message ... dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. It depends on your date format. Click Start / Run / cmd {OK}, then type this command: echo %date%{Enter} What do you see? hello, thank you very much for your answer. i see: 05.12.2008 |
#4
|
|||
|
|||
rename file tgrough bat file
"Natalia" wrote in message ... "Pegasus (MVP)" wrote: "Natalia" wrote in message ... dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. It depends on your date format. Click Start / Run / cmd {OK}, then type this command: echo %date%{Enter} What do you see? hello, thank you very much for your answer. i see: 05.12.2008 OK. Try this: @echo off ren 1.txt "1_%date:.=%.txt" or perhaps this: @echo off for /F "delims=. tokens=1-3" %%a in ('echo %date%') do ren 1.txt "1_%%c%%b%%a.txt" Note that line2 is a long line. Do not break it up! |
#5
|
|||
|
|||
rename file tgrough bat file
"Pegasus (MVP)" wrote: "Natalia" wrote in message ... "Pegasus (MVP)" wrote: "Natalia" wrote in message ... dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. It depends on your date format. Click Start / Run / cmd {OK}, then type this command: echo %date%{Enter} What do you see? hello, thank you very much for your answer. i see: 05.12.2008 OK. Try this: @echo off ren 1.txt "1_%date:.=%.txt" or perhaps this: @echo off for /F "delims=. tokens=1-3" %%a in ('echo %date%') do ren 1.txt "1_%%c%%b%%a.txt" Note that line2 is a long line. Do not break it up! Both variants are working! Thank you very much! |
#6
|
|||
|
|||
rename file tgrough bat file
"Natalia" wrote in message ... "Pegasus (MVP)" wrote: "Natalia" wrote in message ... "Pegasus (MVP)" wrote: "Natalia" wrote in message ... dear all, i have file 1.txt which i'd like to rename to 1_today_date. txt in bat file. For example today is 04.12.2008, i'd like to rename 1.txt to 1_20081204.txt, is it possible? Or in another words how to put sysdate value to variable. Thank you. Natalia. It depends on your date format. Click Start / Run / cmd {OK}, then type this command: echo %date%{Enter} What do you see? hello, thank you very much for your answer. i see: 05.12.2008 OK. Try this: @echo off ren 1.txt "1_%date:.=%.txt" or perhaps this: @echo off for /F "delims=. tokens=1-3" %%a in ('echo %date%') do ren 1.txt "1_%%c%%b%%a.txt" Note that line2 is a long line. Do not break it up! Both variants are working! Thank you very much! Thanks for the feedback. |
Thread Tools | |
Display Modes | |
|
|