Re: Environmental Variables batch files



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%



.



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: long filename -> short filename conversion incorrect
    ... "Pegasus (MVP)" wrote: ... Here is a variant of the previous batch file. ... echo Q> "%temp%\debug.scr" ...
    (microsoft.public.windowsxp.general)
  • Re: how to execute batch file automatically when file is added in folder
    ... Pegasus (MVP) wrote: ... Line2 if not exist c:\OldDir.txt echo. ... Line7 rem Your batch file lines go here ... I cannot tell you what "d:My Folder" should be. ...
    (microsoft.public.windowsxp.general)
  • Re: using NTBackup.exe
    ... "Pegasus (MVP)" wrote: ... @echo off ... Now execute this batch file from a Command ...
    (microsoft.public.windows.server.general)
  • Re: copy/open/move file most most recent datestamp from command li
    ... >> I want to be able to perform one or all of the following commands ... >> be a independent command such that it can be run in a batch file at any date ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.security_admin)

Loading