I already changed control panel (Region and Language) to be hh:mm:ss
tt still get it in the time in h:mm:ss. I ran it on my other machine
and get the same results.
Does anyone have an Idea how to take care of it?
Thanks.
here is my code.
ren Y:\XML\NEO.xml N%time:~0,2%%time:~3,2%%time:~6,3%xml
ren Y:\XML\LOG.txt L%time:~0,2%%time:~3,2%%time:~6,3%txt
also is there a way to use a variable to use it with Ren and/or Move
commands.
for example:
set XName = N%time:~0,2%%time:~3,2%%time:~6,3%xml
set LName = L%time:~0,2%%time:~3,2%%time:~6,3%txt
ren NEO.xml XName
move XName Y:\XML\%FolderName%
What is the right syntax
Thank you
Gary
Though changing the settings in Regional Settings control panel to :
DATE = 16-02-11 (dd-MM-yy) (separator - )
TIME = 6:35pm (h:mm tt) (separator : )
...will result in the Command Prompt displaying :
Echo {%DATE%} > 16-02-11
Echo {%TIME%} > 18:35:29.57
...so we see that the DATE configuration in the Regional Settings control
panel have complete control over the output of the special DATE variable -
but NOT over the special TIME environment variable - we see no matter how
the control panel is set the output remains the same (that is; to include
hundredths of seconds ).
But where BOTH DO make a difference, is in the (cmd.exe) Command Prompt
"date & time" command's output, thus ;
date/t > 16-02-11
time/t > 06.35pm
...and you WILL see any changes made to both DATE and TIME in Regional
Settings control panel reflected in the output of either command (date/t or
time/t).
==
Cheers, Tim Meddick, Peckham, London. :-)
"Gary Segal" <sega...@gmail.com> wrote in message
news:064fd01e-0f84-4b58...@f36g2000pri.googlegroups.com...
Thanks
Here is how to take care of the time in h:mm:ss format
Set FolderName=%date:~10,4%%date:~4,2%%date:~7,2%
Set Time=%time: =0%
Set Time=%time::=%
Set Time=%time:~0,6% REM<---- gives you date in 083752(08:37:52)
IF EXIST Y:\XML\NEO.XML ECHO File Found!
IF EXIST Y:\XML\LOG.TXT ECHO File Found!
Set XName = N%time%.XML
Set LName = L%time%.TXT
ren NEO.XML %XName%
ren LOG.TXT %LName%
Batch-file output :
File Found
File Found
The syntax of the command is incorrect.
The syntax of the command is incorrect.
P.S. I absolutely copied / pasted the script into the contents of a
batch-file and ran it. - It was the same as what you posted.
==
Cheers, Tim Meddick, Peckham, London. :-)
"Gary Segal" <sega...@gmail.com> wrote in message
news:2fc9a76e-8fb7-4e57...@a28g2000prb.googlegroups.com...
Tim Meddick wrote:
>> "Gary Segal" <sega...@gmail.com> wrote:
>>
>> Thanks
>> Here is how to take care of the time in h:mm:ss format
>>
>> Set FolderName=%date:~10,4%%date:~4,2%%date:~7,2%
>> Set Time=%time: =0%
>> Set Time=%time::=%
>> Set Time=%time:~0,6% REM<---- gives you date in 083752(08:37:52)
>>
>> IF EXIST Y:\XML\NEO.XML ECHO File Found!
>>
>> IF EXIST Y:\XML\LOG.TXT ECHO File Found!
>>
>> Set XName = N%time%.XML
>> Set LName = L%time%.TXT
>>
>> ren NEO.XML %XName%
>> ren LOG.TXT %LName%
> Tried out your supplied script...........
>
> Batch-file output :
>
> File Found
> File Found
> The syntax of the command is incorrect.
> The syntax of the command is incorrect.
>
>
> P.S. I absolutely copied / pasted the script into the contents of a
> batch-file and ran it. - It was the same as what you posted.
After the past week's discussions of not using the intrinsic variable names
of DATE or TIME as user variable names and spaces around equal signs, we
seem to still be gluttons for punishment.
The messages above are easily explained.
1. The files NEO.XML and LOG.TXT appear to exist in Y:\XML\ however, the
REName commands failed to include the Y:\XML\ path in the REN source name.
Thus, it assumes the files exist in the current folder.
2. Variables "XName " and "LName " are being set with spaces on both sides
of the equal sign. Hence the names being set include the trailing space but
%XName% and %LName% do not include the trailing spaces. Likewise, the values
being set to
N%time%.XML and L%time%.TXT both include a preceding space (however, in this
case are not causing a problem).
The following is how I would rewrite the code. (YMMV)
@echo off
SET "mydate=%date%"
Set "FolderName=%mydate:~10,4%%mydate:~4,2%%mydate:~7,2%"
IF NOT exist Y:\XML\%FolderName% MD Y:\XML\%FolderName%
Set "mytime=%time: =0%"
Set "mytime=%mytime::=%"
Set "mytime=%mytime:~0,6%"
REM<---- sets mytime as hhmmss 083752(08:37:52)
IF EXIST Y:\XML\NEO.XML (
ECHO Moving Y:\XML\NEO.XML to Y:\XML\%FolderName%\N%mytime%.XML
MOVE Y:\XML\NEO.XML Y:\XML\%FolderName%\N%mytime%.XML
)
IF EXIST Y:\XML\LOG.TXT (
ECHO Moving Y:\XML\LOG.TXT to Y:\XML\%FolderName%\L%mytime%.TXT
MOVE Y:\XML\LOG.TXT Y:\XML\%FolderName%\L%mytime%.TXT
)
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
The main reason for posting, anyway, that the code had failed, was to bring
that fact to the OP's attention...
...and I thank you for going into detail of exactly what went wrong for
him.
==
Cheers, Tim Meddick, Peckham, London. :-)
"Todd Vargo" <tlv...@sbcglobal.netz> wrote in message
news:iji9c5$uqr$1...@news.albasani.net...
Please stop top posting. You can see that it is not normal in this group.
Remember the old adage: "When in Rome, do as the Roman's do..."
--
Regards,
Mic
I don't live in an "Outlook Express bubble" - I actually go to
website-interfaces to usernet groups, and view my output there from time to
time, and I can see no distinct disadvantage, whatsoever, to my
top-posting.
Far from it, I maintain that it (seem to me, at least) is allot easier to
comprehend that the answer (newer material ) comes first followed by the
older (repeated) text - included only for reference.
Only a very few people are so irritated by the practice to focus solely on
it, trying to make everyone keep to he exact-same practices as they do -
just seems very neurotic to me.
Like I said, I've looked back at my posts and find them actually much
easier to read than having to "wade" down to get to the new stuff - no idea
why anyone would think that better - but then some people do love to
blindly follow rules - and impose them!
If you have some sort of strange allergy to top-posed quotes, then please
feel free to skip over them.
Until I live in a totalitarian dictatorship of the state, where everyone is
compelled to think and act the same on pain of death, I'll be continuing do
top-post.
I hope you can get over it , see past it and just read the content - as you
are obviously able to do...
==
Cheers, Tim Meddick, Peckham, London. :-)
"foxidrive" <foxi...@gotcha.woohoo.invalid> wrote in message
news:CQu7p.65950$nZ2....@newsfe03.iad...
Yes, yes you are.
--
Regards,
Mic
==
Cheers, Tim Meddick, Peckham, London. :-)
"foxidrive" <foxi...@gotcha.woohoo.invalid> wrote in message
news:Xgv7p.12933$Vn7....@newsfe22.iad...
> On 19/02/2011 01:19, Tim Meddick wrote:
>
> < clipped >
Should have read :
"You know foxidrive, at times you are quite the affable fellow, and at
others.....not"
Not..."sometimes".
Hmmm, and these are the mark of an affable person such as yourself?
You will note that:
1) I merely asked you to please stop top posting.
2) I pointed out that is it not the convention in the batch groups
3) illuminated the fact with an old adage, that it's nicer to follow the
norms and customs of the place you find yourself.
You replied with the ranting, as evidenced from the snippets above (not
below).
--
Regards,
Mic
If you saw yourself in any of my descriptions, then it's not my fault.
In fact, the ONLY descriptive I attributed to you was to say I thought you
were "affable" (sometimes).
==
Cheers, Tim Meddick, Peckham, London. :-)
"foxidrive" <foxi...@gotcha.woohoo.invalid> wrote in message
news:Zyv7p.44326$y_7....@newsfe10.iad...
So you can't bring yourself to follow the norms and customs of the group
you find yourself in.
Why is that?
--
Regards,
Mic
==
Cheers, Tim Meddick, Peckham, London. :-)
"foxidrive" <foxi...@gotcha.woohoo.invalid> wrote in message
news:5qw7p.44559$y_7....@newsfe10.iad...
> On 19/02/2011 02:05, Tim Meddick wrote:
>> The remarks I made were directed at "people who do" the things I
>> mentioned, I never said "You were this" or "You were that".....
>
> < clipped >
>> On 19/02/2011 01:19, Tim Meddick wrote:
>>> anal
>>> petty
>>> irritated
>>> neurotic
>>> blindly follow rules - and impose them!
>>> strange allergy to top-posed quotes
>>> Until I live in a totalitarian dictatorship of the state
>>> compelled to think and act the same on pain of death
>>> I hope you can get over it
>> So you can't bring yourself to follow the norms and customs of the
>> group you find yourself in.
>>
>> Why is that?
>>
*conventional quoting*
> "normal" is such a subjective term....
>
> ==
>
> Cheers, Tim Meddick, Peckham, London. :-)
And you call the ranting terms at the top of this post "normal"?
Yes, well, that's the sort of blinkered, philistine pig ignorance I've
come to expect from you non-creative garbage. You sit there on your
loathsome, spotty behinds squeezing blackheads, not caring a tinker's
cuss for the struggling artist. You excrement! You whining, hypocritical
toadies, with your colour TV sets and your Tony Jacklin golf clubs and
your bleeding Masonic secret handshakes! You wouldn't let me join, would
you, you blackballing bastards! Well, I wouldn't become a freemason now
if you went down on your lousy, stinking knees and begged me!
--
Regards,
Mic
You don't like Monty Python? LOL
I expect you're not familiar with them. No matter.
--
Regards,
Mic
I'm sorry, I thought this was the room for abuse.
>
--
"Nuns! NUNS! Reverse! Reverse!"