Re: Environmental Variables batch files



"Giuseppe" wrote:
Thank you very much, it is a simple and effective solution

Giuseppe


Here is an other example, this deals with different dateformats
http://www.petri.co.il/forums/showpost.php?p=84957&postcount=2

\Rems
"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%



.



Relevant Pages

  • Re: Copying files to another drive
    ... A batch file is a plain text file; you can create it with notepad or any text editor. ... It may include any of the W2k commands; see Help/ Contents/ Reference/ MSDOS Commands. ... I have 3 drives, C:\, D:\ & ... @echo off ...
    (microsoft.public.win2000.general)
  • Re: Bash Script (WAS:Re: Suse 9.3 on a desktop replacement)
    ... PerfectReign wrote: ... > I created a batch file called, ... typed commands -- it spanned 30+ batch files and close to 2000 lines. ... you really want user feedback in the form of echo commands (and ...
    (alt.os.linux.suse)
  • Re: what kind of scripting is this ?
    ... echo Good morning %name% ... Batch files have nothing in common with VB Scripting. ... is far more powerful than batch file programming. ... A batch file consists of a collection of commands ...
    (microsoft.public.scripting.vbscript)
  • Re: total size of files
    ... echo Total=%Total% ... Thanks for picking up the extra colon. ... "dir dir" commands should proably be reduced to just one. ... I note with concern that we're deep into a batch file discussion even though ...
    (microsoft.public.scripting.vbscript)
  • Re: Environmental Variables batch files
    ... "Pegasus (MVP)" wrote: ... I was looking on how to do a batch file that created a folder with the ... You will find a lot of help built into the respective commands, ... Now try this: echo %year%-%month%-%day% ...
    (microsoft.public.windows.server.scripting)

Loading