Re: Environmental Variables batch files
- From: Giuseppe <Giuseppe@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 15 Dec 2007 01:44:00 -0800
Thank you very much, it is a simple and effective solution
Giuseppe
"Pegasus (MVP)" wrote:
.
"Giuseppe" <Giuseppe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B8D39BC9-50DF-4BD3-9B1C-6D10DA3660BC@xxxxxxxxxxxxxxxx
Hello
I was looking on how to do a batch file that created a folder with the
actual date.
On the internet I found this suggestion: md "%DATE:/=_%"
it works but another problem is that I want to write it in the format
yyyy-mm-dd even if the computer is set with the format dd-mm-yyyy.
Then I didn't know that was possible to change the output of an
environmental variable as "%DATE:/=_%"; do you know where can I find
something about this?
And I was looking for some good and complete resources on about writing
batch files
Thanks
Giuseppe
You will find a lot of help built into the respective commands, e.g.
set /?
for /?
In your case you need to disassemble, then reassemble the date
variable. If the command "echo %date" returns a value of
the form "ddd dd/mm/yyyy" then the following would work nicely:
dow=%date:~0,3%
day=%date:~4,2%
month=%date:~7,2%
year=%date:~10,4%
Now try this: echo %year%-%month%-%day%
- Follow-Ups:
- Re: Environmental Variables batch files
- From: \RemS
- Re: Environmental Variables batch files
- References:
- Re: Environmental Variables batch files
- From: Pegasus \(MVP\)
- Re: Environmental Variables batch files
- Prev by Date: Re: Environmental Variables batch files
- Next by Date: Re: Environmental Variables batch files
- Previous by thread: Re: Environmental Variables batch files
- Next by thread: Re: Environmental Variables batch files
- Index(es):
Relevant Pages
|
Loading