Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: for usage of %date% and %time% vars in filenames

382 views
Skip to first unread message
Message has been deleted

Tom Lavedas

unread,
Nov 22, 2010, 3:16:47 PM11/22/10
to
On Nov 22, 2:43 pm, alexsupra <alexsu...@gmail.com> wrote:
> ::
> @echo off
> for /f "delims=/-. tokens=3,2,1" %%a in ("%DATE%") do for /f
> "tokens=2,3,4" %%d in ("%%a %%b %%c") do set numberdate=%%d%%e%%f
> echo %numberdate%
> :: does anybody how to get numbertime?
> :: i mean adding of one more string with for cycle that takes as input
> data current value of %time%
> echo %numbertime%
> pause

Do you mean ...

for /f "tokens=2-4 delims=/-. " %%a in ("%Date%") do set numberdate=%%a
%%b%%c
for /f "tokens=1-4 delims=:." %%a in ("%Time%") do set numbertime=%%a
%%b%%c%d
echo %numberdate% %numbertime%
_____________________
Tom Lavedas

foxidrive

unread,
Nov 23, 2010, 12:30:09 AM11/23/10
to
On 23/11/2010 06:43, alexsupra wrote:
> ::
> @echo off
> for /f "delims=/-. tokens=3,2,1" %%a in ("%DATE%") do for /f
> "tokens=2,3,4" %%d in ("%%a %%b %%c") do set numberdate=%%d%%e%%f
> echo %numberdate%
> :: does anybody how to get numbertime?
> :: i mean adding of one more string with for cycle that takes as input
> data current value of %time%
> echo %numbertime%
> pause

Be aware that time and date are different according to regional settings.

Using WSH is a reliable way for getting date and time variables.

Here's a batch script for military time format:

@echo off
for /f "tokens=1-4 delims=.:" %%a in ("%time%") do set t=%%a%%b%%c
set t=%t: =0%
echo %t%
pause

--
Regards,
Mic

alexsupra

unread,
Nov 23, 2010, 10:57:49 AM11/23/10
to

yes, we got it!
there was a little problem with milliseconds value after comma, but i
fixed it.

::
@echo off
for /f "delims=/-. tokens=3,2,1" %%a in ("%date%") do for /f


"tokens=2,3,4" %%d in ("%%a %%b %%c") do set numberdate=%%d%%e%%f
echo %numberdate%

for /f "tokens=1-4 delims=.:" %%a in ('time /t') do set numbertime=%%a%
%b%%c
set numbertime=%numbertime: =0%
echo %numbertime%
pause
::

thus if we call shellget.cmd before this code for example we can
create extremly nice folder via
mkdir "%mydocs%\%numberdate%_%numbertime%"
and other similar useful operations! =) thanks again.

Message has been deleted

I'm_HERE

unread,
Nov 23, 2010, 2:47:17 PM11/23/10
to

---------8<--------------------
set "dateTime=%date%_%Time: =0%"
for %%a in ("/" "-" "." ":" ",") do (
call set "dateTime=%%dateTime:%%~a=%%"
)
mkdir "%mydocs%\%dateTime%"
--------8<--------------------

foxidrive

unread,
Nov 23, 2010, 8:12:06 PM11/23/10
to

It's brief. :)


The issues it has is with am/pm times - and regional settings vary the
date format.

The output won't always be standard, or the preferred yyyymmdd-hhmmss
but it's a clever bit of code.


--
Regards,
Mic

Dr J R Stockton

unread,
Nov 24, 2010, 2:02:45 PM11/24/10
to
In alt.msdos.batch.nt message <ujIGo.40685$Ou2....@newsfe20.iad>, Tue,
23 Nov 2010 16:30:09, foxidrive <foxi...@gotcha.woohoo.invalid>
posted:

>Here's a batch script for military time format:

As well as being careful about localisation of code, one should be
careful about localisation of text. Your "military time format" is an
Americanism, not used normally in English. Better to say "an ISO 8601
time format", or, if the thought of visibly complying with an
International Standard cannot be tolerated, then "24-hour clock time".

Better to use WSH with JavaScript, which can easily have code for local
date/time and GMT date/time, with one commented out, and have it set a
variable to YYYY-MM-DD hh:mm:ss.sss[Z]. From that location-independent
string, well-known batch code can extract whatever is currently needed.

I forget which : but having something like that in the FAQ either is, or
would be, a good thing ... it's approximately in Item 1.

Comment on FAQ - it contains many instances of "The Visual Basic
Script". ISTR that purists would say that VBScript and Visual Basic
are, although similar, distinct languages.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.07 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

foxidrive

unread,
Nov 24, 2010, 10:22:44 PM11/24/10
to
On 25/11/2010 06:02, Dr J R Stockton wrote:

> As well as being careful about localisation of code, one should be
> careful about localisation of text. Your "military time format" is an
> Americanism, not used normally in English.

It's been around since you were a little kid. :)

Surely the military all over the world use a 24 hour clock.


--
Regards,
Mic

alexsupra

unread,
Nov 25, 2010, 7:49:47 AM11/25/10
to

just made some updates to avoid formats wars

::
@echo off
:: get current delims
for /f "tokens=2*" %%a in ('reg query "hkcu\control panel
\international" /s ^|find /i "sdate"') do set "sdate=%%b"
::for /f "tokens=2*" %%a in ('reg query "hkcu\control panel
\international" /s ^|find /i "stime"') do set "stime=%%b"
for /f "delims=%sdate% tokens=3,2,1" %%a in ("%date%") do for /f
"tokens=2,3,4" %%d in ("%%a %%b %%c") do set numdate=%%d%%e%%f
echo %numdate%
for /f "tokens=1-4 delims=.:-" %%a in ('time /t') do set numtime=%%a%%b
%%c
set numtime=%numtime: =0%
echo %numtime%
pause
::

foxidrive

unread,
Nov 25, 2010, 8:05:02 AM11/25/10
to


Do yourself a favour and turn to WSH or WMIC as outlined below:
They are standard across any machine that can use them.


:: DateTime - WMIC
@echo off
:: info based on usenet post by ten.n...@virgin.net
:: 18 Aug 2008 22:29:38 +0100,
:: xp and higher

(
Wmic Path Win32_LocalTime Get day,hour,minute,month,second,year /value
)>%temp%.\wmicinfo.txt
for /f "delims=" %%a in ('type %temp%.\wmicinfo.txt') do set %%a
del %temp%.\wmicinfo.txt
set Day=00%day%
set Hour=00%hour%
set Minute=00%minute%
set Month=00%month%
set Second=00%second%
set Day=%day:~-2%
set Hour=%hour:~-2%
set Minute=%minute:~-2%
set Month=%month:~-2%
set Second=%second:~-2%
set yr=%year:~2%

echo Hour=%hour%
echo Minute=%minute%
echo Second=%second%
echo Day=%day%
echo Month=%month%
echo Year=%year%
echo Yr=%yr%
pause

:: DateTime using WSH
:: datetime.bat V4
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This uses Windows Scripting Host to set variables
:: to the current date/time/day/day_number
:: for Win9x/ME/NT/W2K/XP etc
:: Thanks go to Todd Vargo for his scripting
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
set TmpFile="%temp%.\tmp.vbs"
echo> %TmpFile% n=Now
echo>>%TmpFile% With WScript
echo>>%TmpFile% .Echo "set year=" + CStr(Year(n))
echo>>%TmpFile% .Echo "set yr=" + Right(Year(n),2)
echo>>%TmpFile% .Echo "set month="+ Right(100+Month(n),2)
echo>>%TmpFile% .Echo "set day=" + Right(100+Day(n),2)
echo>>%TmpFile% .Echo "set hour=" + Right(100+Hour(n),2)
echo>>%TmpFile% .Echo "set min=" + Right(100+Minute(n),2)
echo>>%TmpFile% .Echo "set sec=" + Right(100+Second(n),2)
echo>>%TmpFile% .Echo "set dow=" + WeekDayName(Weekday(n),1)
echo>>%TmpFile% .Echo "set dow2=" + WeekDayName(Weekday(n))
echo>>%TmpFile% .Echo "set iso=" + CStr(1 + Int(n-2) mod 7)
echo>>%TmpFile% .Echo "set iso2=" + CStr(Weekday(n,2))
echo>>%TmpFile% End With
cscript //nologo "%temp%.\tmp.vbs" > "%temp%.\tmp.bat"
call "%temp%.\tmp.bat"
del "%temp%.\tmp.bat"
del %TmpFile%
set TmpFile=
set stamp=%year%-%month%-%day%_%hour%.%min%.%sec%


echo The year (YYyy) is "%year%"
echo The year (yy) is "%yr%"
echo The month is "%month%"
echo The day (%dow%) is "%day%"
echo The full weekday name is "%dow2%"
echo.
echo ISO 8601 Day-Of-Week number is "%iso%"
echo.
echo The hour is "%hour%"
echo The minute is "%min%"
echo The second is "%sec%"
echo.

echo The date and time stamp is "%stamp%"
echo.
echo time (hhmmss) (%hour%%min%%sec%)
echo.
echo date A (yyyymmdd) (%year%%month%%day%)
echo date B (mmddyyyy) (%month%%day%%year%)
echo date C (ddmmyyyy) (%day%%month%%year%)
echo.
echo date D [yymmdd] [%yr%%month%%day%]
echo date E [mmddyy] [%month%%day%%yr%]
echo date F [ddmmyy] [%day%%month%%yr%]
:: datetime.bat
::::::::::::::::::::::::::::::::::::::::::::::::::::::::


--
Regards,
Mic

alexsupra

unread,
Nov 25, 2010, 8:24:55 AM11/25/10
to
> :: info based on usenet post by ten.nig...@virgin.net

thank you but wmic is not so good solution for such fast operations
(they should be fast) as assigning name to new dir. wmic requires wmi
to operate and it requires wmi service to be started. i tried wmi many
times cause it can do a lot and even more... but after testing "WMI
subsystem" for a long period of time on different machines and in
different situations it spoiled my opinion about it self. its very
slow and unstable especially when smth going wrong i.e. in most
possible system problems or fails (like viruses attacks, wars of
bloated software, etc) wmi is usually one of the first victims.
it seems to me that external (3rd party) free tools can be used better
as possible alternative.

foxidrive

unread,
Nov 25, 2010, 9:05:46 AM11/25/10
to
On 26/11/2010 00:24, alexsupra wrote:

> thank you but wmic is not so good solution for such fast operations
> (they should be fast) as assigning name to new dir. wmic requires wmi
> to operate and it requires wmi service to be started. i tried wmi many
> times cause it can do a lot and even more... but after testing "WMI
> subsystem" for a long period of time on different machines and in
> different situations it spoiled my opinion about it self. its very
> slow and unstable especially when smth going wrong


So, what did you think of the other solution, using WSH?

--
Regards,
Mic

Frank Westlake

unread,
Nov 25, 2010, 10:55:14 AM11/25/10
to
Mic wrote:
>Dr J R Stockton wrote
>> Your "military time format" is an
>> Americanism, not used normally in English.

> Surely the military all over the world use a 24 hour clock.

It's true. The military uses military time all over the world -- and
in space. But the 24-hour clock is a thing of Earth -- shouldn't we
use something more universal?

Frank

alexsupra

unread,
Nov 25, 2010, 2:09:38 PM11/25/10
to

in general WSH is powerful. to say the truth i havent enough
experience in solving tasks with using of it, but use sometimes when
its practically impossible to do something with built in cmd.exe and
additional multipurpose tools (actually on my practice it happened one
or two times).
as to our particular case i think that as additional enviroment to
cmd.exe i would prefer nircmd.exe cause it runs extremly fast and the
code is really very tiny.
this example of usage on similar task.
once i had understood that it would be great for users and admins to
have such useful thing as possibility to clone any file or dir via
context shell menu. simply the easy way of creating one more copy
automatically renamed with new name consisting of original name and
time/date stamp. thus i made the following code:

:: usetools command shell script ::
::
@echo off
chcp 1251
set cdname=%~dp1
set filename=%~n1
set filenamext=%~x1
cd /d "%cdname%"
if exist "%cdname%%filename%_%date%%filenamext%" (
nircmd.exe shellcopy "%cdname%%filename%%filenamext%" "%cdname%
%filename%_%date%_~$currtime.hh-mm-ss$%filenamext%" yestoall noerrorui
exit
)
nircmd.exe shellcopy "%cdname%%filename%%filenamext%" "%cdname%
%filename%_%date%%filenamext%" yestoall noerrorui
exit
::

NirCmd home: http://www.nirsoft.net/utils/nircmd2.html

alexsupra

unread,
Nov 25, 2010, 5:46:43 PM11/25/10
to

i should say that code is rather old (clonfile.cmd, 09dec2009) and not
universal enough as stand alone one. i mean it needs registry settings
that are completely integrated inside self-made installation system on
russian lang. so it would be not so polite to publish there cyrrilic
fonts. so i see rather good way of returning to cmd is applying via
cmd cmdscript system registry settings that depends upon language of
os. to keep the universal format of clonfile.cmd we should detect what
is the os lang. in registry. comrades, who knows such the most correct
and allways working place in this deep forest of nt system registry?
than its possible to decide which locale is default and read
corresponding section of clonfile.ini, isnt it?..

foxidrive

unread,
Nov 25, 2010, 8:54:06 PM11/25/10
to
On 26/11/2010 06:09, alexsupra wrote:
> On 25 ноя, 17:05, foxidrive<foxidr...@gotcha.woohoo.invalid> wrote:
>> On 26/11/2010 00:24, alexsupra wrote:
>>
>>> thank you but wmic is not so good solution for such fast operations
>>> (they should be fast)
>>
>> So, what did you think of the other solution, using WSH?
>
> in general WSH is powerful. to say the truth i havent enough
> experience in solving tasks with using of it

Did you actually try the WSH solution I posted? It is below the WMIC
solution.

If you are getting time and date stamps for your personal use then any
solution is fine.

I posted the solutions using WMIC and WSH because they will work in any
region of the world, and this is one of the most frequently asked questions.

--
Regards,
Mic

alexsupra

unread,
Nov 25, 2010, 9:58:51 PM11/25/10
to

read the code, tested it - it works, provides more than enough info.
from the technical point of view it uses cmd.exe and cscripts.exe,
uses call, operates with file system and registry. in general it is
very good and correct script as perfect example for education
literature about programming with using of built-in enviroment. i
saved it to my local code storage, it can be useful in some situations
but as to practical usage its not perfect cause it is rather huge i
think, works slower (but do more as i said), uses call. that means
when i call it from other.cmd script and datetime.bat calls "%temp%.
\tmp.bat" the other.cmd think that datetime.bat is finished its
processing earlier than it should. can this setting be overriden or
can datetime.bat work somehow without this calling?

foxidrive

unread,
Nov 25, 2010, 10:39:50 PM11/25/10
to
On 26/11/2010 13:58, alexsupra wrote:

>> If you are getting time and date stamps for your personal use then any
>> solution is fine.
>>
>> I posted the solutions using WMIC and WSH because they will work in any
>> region of the world, and this is one of the most frequently asked questions.
>>

> saved it to my local code storage, it can be useful in some situations
> but as to practical usage its not perfect cause it is rather huge i
> think, works slower (but do more as i said), uses call. that means
> when i call it from other.cmd script and datetime.bat calls "%temp%.
> \tmp.bat" the other.cmd think that datetime.bat is finished its
> processing earlier than it should. can this setting be overriden or
> can datetime.bat work somehow without this calling?

Why is a script of a couple of kilobytes somehow inappropriate? You
work with far larger executables in windows.


As for the CALL keyword, I am unsure why you think it is a problem.

Try this:

@echo off
echo.@echo B>second.bat
echo A
call second.bat
echo C
pause


The execution of the first batch file is halted while second.bat runs
and when second.bat terminates then the first batch file continues.

--
Regards,
Mic

Todd Vargo

unread,
Nov 26, 2010, 11:35:27 AM11/26/10
to
alexsupra wrote:
> On Nov 26, 4:54 am, foxidrive <foxidr...@gotcha.woohoo.invalid> wrote:
>> On 26/11/2010 06:09, alexsupra wrote:
>>

You "think"? This is a fair indication that you don't know. Please post an
actual example which demonstrates that one batch CALLs another batch but
does not return to the first batch simply because the second batch uses a
CALL statement.

alexsupra

unread,
Nov 26, 2010, 2:50:25 PM11/26/10
to

yes, i think. and thats why i'm here.
in this particular case i said "i think" to show that i am not
asserting the absolute fact. i just sharing the knoledge based on the
real development i.e. practical programming of different kinds
including cmd and practical usage of scripts for the project needs.
i'm getting the all feedback from many people including the comrades
in the project which i found about 4 years ago, outsourcing and
freelancing system integrators, programmers, administrators inside our
project, also external feedback from other projects. thus if think it
is based on the real investigations, experiments and lots of practice.
otherwise i wouldnt spent my time on publishing things which i'm not
checked cause its not connected with my real work in project which i'm
interested in.
your non-adequate emotional feel (fair indication) based actually on
nothing concerning my self and my activity cause you really dont know.
and from the other point of view. this group is for sharing the
knoledge and practical experience. i'm sure that each of us who is
able to think aims to reach the best of him self by information
interaction. here i'm absolutly sure cause several years of
integration of new software products in companies made me not only to
create, edit, optimize the code, configurations, documentation on
different languages, communicate with developers, write reports and
some articles, but to teach. to teach people to work in absolutly new
for them enviroment, new toolsets. and to make better defaults for
them on the go. so on the base of that experience i'm absolutly sure
that even in case if you transfer the information to some people wich
are new to it simultaniously i get some new things for yourself. and
even if you allready did it a lot of times you should be able to
explore and discover some new things via people which are new to
things that you provide. thats the real advantage of powerful
knoledge.
i see that you know something but your methode of communication is
poor and ugly. because it demonstrates that your blaming of my non
existing personal features is your subconscious fear not to be the
person "who says things that dont know or smth like that". it means
that such subconscious feels is the reflection of you that you try to
hide by hating and attacking persons who seems to feet this model of
person. in our case its not fair indication about myself (its fairy
tales by your emotional imagination) but fairy indication for those
who able to think about your "hidden" nature of your sel. moving
further. actually it means that you know something and maybe some of
that could be useful for somebody here and for my project too but such
behavior is similar to behaviour of people that know something but not
too much. and too lazy for moving further but glad to attack others
who dont know something but try to.
thus i am not interested in working together with you and your
demonstration of your personal problems is not the reason for me to
post the code specially for you to prove something. by the way
regularry updated code is allready being published about 3 years at
usetools.net so i'm not hiding anything. the conclusion: i would
prefer to work in more pleasent and positive way about things
connected with my project to get the best results. thank you and have
a nice day.

Dr J R Stockton

unread,
Nov 26, 2010, 12:49:41 PM11/26/10
to
In alt.msdos.batch.nt message <9EkHo.35282$sK1....@newsfe21.iad>, Thu,
25 Nov 2010 14:22:44, foxidrive <foxi...@gotcha.woohoo.invalid>
posted:

A further demonstration that Americans don't know English. I wrote
"localisation of text", not "localisation of time format"

The 24-hour clock is widely used outside America, and not only by the
military. But the term "military time" is an Americanism. Here, we use
the term "24-hour clock", and for your way the term "12-hour clock".

But as we are used to seeing the 24-hour clock used widely, especially
for timetables, we don't often need those terms. Generally, though not
without exceptions, we use the 12-hour clock only when the context makes
a.m./p.m. unnecessary, or in speech.

But do you know the US Army + UK Army "Zulu time" joke, which
was on the Net in the early 1990s? I recall the point, but want
the authentic words.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

Message has been deleted

foxidrive

unread,
Nov 26, 2010, 8:19:12 PM11/26/10
to
On 27/11/2010 11:01, alexsupra wrote:

> On Nov 26, 6:39 am, foxidrive<foxidr...@gotcha.woohoo.invalid> wrote:
>> On 26/11/2010 13:58, alexsupra wrote:
>>
>> Why is a script of a couple of kilobytes somehow inappropriate? You
>> work with far larger executables in windows.
>>
>> As for the CALL keyword, I am unsure why you think it is a problem.
>>
>>
>> The execution of the first batch file is halted while second.bat runs
>> and when second.bat terminates then the first batch file continues.
>>
>> --
>> Regards,
>> Mic
>
> 1) i mean the pattern
> script1.cmd --call1--> script2.cmd --call2--> script3.cmf


I don't know what you mean.


Regarding Todd, he is skilled with batch files and doesn't actually have
any personal problems here in the group - but I do see that he is
frustrated with people that arrive in this newsgroup and do one of the
following:

some do no research,

some want to be supplied with a working solution without supplying
details when asked,

some change the task 2 or 3 times in the course of the thread which
alters the script and wastes time,

some are rather stupid when it comes to scripting and have trouble just
copying & pasting,

and some just want to show how clever they are and disregard the
enormous years of experience in practical batch file matters that the
collective regulars here have.


For what it's worth I share Todd's frustration - yet I enjoy scripting
and I take the opportunity to help people, even if the majority don't
show appreciation.


If you want to discuss batch files then this is the right place.


--
Regards,
Mic

foxidrive

unread,
Nov 26, 2010, 8:27:37 PM11/26/10
to
On 27/11/2010 11:01, alexsupra wrote:
> On Nov 26, 6:39 am, foxidrive<foxidr...@gotcha.woohoo.invalid> wrote:
>> On 26/11/2010 13:58, alexsupra wrote:
>>
>> Why is a script of a couple of kilobytes somehow inappropriate? You
>> work with far larger executables in windows.
>>
>> As for the CALL keyword, I am unsure why you think it is a problem.
>>
>>
>> The execution of the first batch file is halted while second.bat runs
>> and when second.bat terminates then the first batch file continues.
>>
>> --
>> Regards,
>> Mic
>

foxidrive

unread,
Nov 26, 2010, 8:38:44 PM11/26/10
to
On 27/11/2010 11:01, alexsupra wrote:
> On Nov 26, 6:39 am, foxidrive<foxidr...@gotcha.woohoo.invalid> wrote:
>> On 26/11/2010 13:58, alexsupra wrote:
>>
>> Why is a script of a couple of kilobytes somehow inappropriate? You
>> work with far larger executables in windows.
>>
>> As for the CALL keyword, I am unsure why you think it is a problem.
>>
>>
>> The execution of the first batch file is halted while second.bat runs
>> and when second.bat terminates then the first batch file continues.
>>
>> --
>> Regards,
>> Mic
>

Todd Vargo

unread,
Nov 27, 2010, 7:10:44 AM11/27/10
to
alexsupra wrote:
> On Nov 26, 7:35 pm, "Todd Vargo" <tlva...@sbcglobal.netz> wrote:
>> alexsupra wrote:
<snip>

No, I did not I attack you nor have an emotional attachment. You made a
claim that using a CALL statement from within a CALLed batch would cause the
other.cmd to think it is finished based on no actual occurrence or evidence.
I am not aware of any such anomaly occurring and am only interested in such
discussion. Your big long emotional rant only demonstrates your own
insecurities. If you want to discuss the CALL issue, I am interested. If you
just want to rant, I'm only too happy to add you to the twit filter.

alexsupra

unread,
Nov 27, 2010, 9:37:33 AM11/27/10
to

i suppose that it was misunderstanding from the both sides including
mine.
it was not emotional clame i just try to provide detailed information
on foreign language.
if there is not enough details its allways possible to ask to provide
more info, other kind of info, etc.
or provide your own more correct info on the topic without starting
conflict cause of lack of info, isnt it?

my situation was the following.
CALL within command shell script 1.cmd
which is started by Active Setup (one of Active Setup items)
1.cmd CALLs subroutine 2.cmd
if 2.cmd also includes CALL statements i.e. 2.cmd CALLs 3.cmd than
1.cmd going further like 2.cmd is allready finished and returned
control to 1.cmd
after some experiments on practice i noticed results of not completed
work processed by scripts and supposed that it is variant of work
possible with such model in general or specifically in my enviroment.
if this model is trully working one without described disadvantage of
early interruption it makes the situation better than i thought
before.
returning to situation with datetime.bat - i liked that script a lot
and i never seen such complete solution made specially for time/date
and vars.
thanks go to Todd Vargo for his scripting.
but according to my experience concerning cmd scripting if i run 1.cmd
that CALLs 2.cmd that CALLs datetime.bat i should get something going
wrong (maybe not in datetime.bat but in general sucess).
thank you again and sorry for possible inconvenience.


if i was wrong in some definitions please let me know.

Frank Westlake

unread,
Nov 27, 2010, 10:19:50 AM11/27/10
to
Dr J R Stockton wrote:

> A further demonstration that Americans don't know English.

I had assumed from his location that Mic is Austrailian, but the
terminology matters less than the value used or presented. Please
let's not bicker about how things are said. Please allow language and
other cultural differences.

Frank

Todd Vargo

unread,
Nov 28, 2010, 12:15:16 AM11/28/10
to
alexsupra wrote:
> my situation was the following.
> CALL within command shell script 1.cmd
> which is started by Active Setup (one of Active Setup items)
> 1.cmd CALLs subroutine 2.cmd
> if 2.cmd also includes CALL statements i.e. 2.cmd CALLs 3.cmd than
> 1.cmd going further like 2.cmd is allready finished and returned
> control to 1.cmd

Ok, I'm with you so far. However, it is impossible to identify the cause of
the problem without seeing the actual code that causes it.

> after some experiments on practice i noticed results of not completed
> work processed by scripts and supposed that it is variant of work
> possible with such model in general or specifically in my enviroment.
> if this model is trully working one without described disadvantage of
> early interruption it makes the situation better than i thought
> before.
> returning to situation with datetime.bat - i liked that script a lot
> and i never seen such complete solution made specially for time/date
> and vars.
> thanks go to Todd Vargo for his scripting.
> but according to my experience concerning cmd scripting if i run 1.cmd
> that CALLs 2.cmd that CALLs datetime.bat i should get something going
> wrong (maybe not in datetime.bat but in general sucess).
> thank you again and sorry for possible inconvenience.
>
>
> if i was wrong in some definitions please let me know.

Again, without seeing the actual code from all three of the batch files, it
is impossible to identify the cause or offer a solution.

Frank P. Westlake

unread,
Nov 28, 2010, 9:08:30 AM11/28/10
to
"alexsupra"
news:6eaa5f53-75a3-4068...@z4g2000yqz.googlegroups.com...

> my situation was the following.
> CALL within command shell script 1.cmd
> which is started by Active Setup (one of Active Setup items)
> 1.cmd CALLs subroutine 2.cmd
> if 2.cmd also includes CALL statements i.e. 2.cmd CALLs 3.cmd than
> 1.cmd going further like 2.cmd is allready finished and returned
> control to 1.cmd
> after some experiments on practice i noticed results of not completed
> work processed by scripts and supposed that it is variant of work
> possible with such model in general or specifically in my enviroment.


We as a group seem to be unaware of this problem. That might be true or
there might be some misunderstanding due to the various languages
involved.

If you are able, please create some small scripts which demonstrate this
problem with the CALL command and present them here. If the problem only
occurs with large or difficult scripts then present some scripts with
the large or difficult portions replaced with a notation similar to
"LARGE OR DIFFICULT PART HERE".

My goal is that we can see the commands you are using and the procedures
you are using.

Frank


alexsupra

unread,
Nov 28, 2010, 10:02:49 AM11/28/10
to
On Nov 28, 5:08 pm, "Frank P. Westlake" <frank.westl...@gmail.com>
wrote:

it seems to be very good idea. soon i will be rearraging and updating
the part of project-related work including mentioned parts of code.
then i will try to find some of old versions containing good example
of problem and prepair it properly for posring here. (i didnt solve
the problem directly but overcame it)

Todd Vargo

unread,
Nov 28, 2010, 10:28:17 AM11/28/10
to

I can only think of one instance that would cause a CALLed batch to make a
CALLing batch (in fact CMD.EXE) abort prematurely. That is if the CALLed
batch used an EXIT statement without the /B switch.

foxidrive

unread,
Nov 28, 2010, 2:08:00 PM11/28/10
to

Or if a CALLed batch file executes another batch file *without* a CALL
statement.


--
Regards,
Mic

foxidrive

unread,
Nov 28, 2010, 2:11:00 PM11/28/10
to
On 29/11/2010 02:28, Todd Vargo wrote:

Or if a CALLed batch file executes another batch file *without* a CALL
statement.

--
Regards,
Mic

Todd Vargo

unread,
Nov 28, 2010, 3:06:14 PM11/28/10
to

No, processing returns to the Original CALLing batch even though the
intermediate batch does not use a CALL to invoke a subsequent batch. Only
the intermediate batch loses the remainder of its processing by failing to
use a CALL.

::1.cmd
@echo off
echo calling 2.cmd
call 2.cmd
echo returned to %0
pause


::2.cmd
@echo off
echo this is %0
3.cmd
echo 2.cmd will not return without a CALL statement


::3.cmd
@echo off
echo this is %0

foxidrive

unread,
Nov 28, 2010, 4:18:37 PM11/28/10
to
On 29/11/2010 07:06, Todd Vargo wrote:

> foxidrive wrote:
>>> I can only think of one instance that would cause a CALLed batch to make
>>> a CALLing batch (in fact CMD.EXE) abort prematurely. That is if the
>>> CALLed batch used an EXIT statement without the /B switch.
>>
>> Or if a CALLed batch file executes another batch file *without* a CALL
>> statement.
>
> No, processing returns to the Original CALLing batch even though the
> intermediate batch does not use a CALL to invoke a subsequent batch.
> Only the intermediate batch loses the remainder of its processing by
> failing to use a CALL.

So it does. Thanks for the demo.

> ::1.cmd
> @echo off
> echo calling 2.cmd
> call 2.cmd
> echo returned to %0
> pause
>
>
> ::2.cmd
> @echo off
> echo this is %0
> 3.cmd
> echo 2.cmd will not return without a CALL statement
>
>
> ::3.cmd
> @echo off
> echo this is %0
>


--
Regards,
Mic

foxidrive

unread,
Nov 28, 2010, 4:58:52 PM11/28/10
to
On 29/11/2010 08:18, foxidrive wrote:
> So it does. Thanks for the demo.

Thunderbird keeps sending these LOL

I'll have to call International Rescue...

--
Regards,
Mic

Dr J R Stockton

unread,
Nov 28, 2010, 1:44:13 PM11/28/10
to
In alt.msdos.batch.nt message <64dff100-c192-4f85-b66d-e403523fd863@o11g
2000prf.googlegroups.com>, Sat, 27 Nov 2010 07:19:50, Frank Westlake
<frank.w...@gmail.com> posted:

Unnecessarily localised terminology should be avoided in international
technical communication. Especially by those who should be using the
Queen's English rather than the President's. YSCIB.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 8.
Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.

mss

unread,
Nov 28, 2010, 7:19:25 PM11/28/10
to
Dr J R Stockton wrote:

> A further demonstration that Americans don't know English. I wrote
> "localisation of text", not "localisation of time format"

Its relative - Blighty only speaks a balkanized
Germanic dialect, & from that we can extrapolate
the UK doesn't speak proper Deutsch? Good grief...

Bar-Bar > Barbarian 'They speak like sheep'

--
later on,
Mike

http://www.topcat.hypermart.net/index.html

0 new messages