Search found 967 matches

by jeb
09 Nov 2007 05:23
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 12983

Hi raj_repos, C:\>testak.bat file1.txt More than 20 minutes, exactly 727 minutes actually the file was created only one minutes before interessting ... On my system it works, so I suppose it could be a problem with different time-formats or so. Simply add some debugcode, like this @echo off setlocal...
by jeb
06 Nov 2007 06:26
Forum: DOS Batch Forum
Topic: how to get the return value on variable
Replies: 10
Views: 16323

Hi, Well spotted Jeb Thats what happens when you don't test..... ok, ok, you are right I don't test... Now that i've looked a bit harder at it, it appears that the output does have TABS in it and also lots of lines that we are not interested in, so use this line to be exact. FOR /F "TOKENS=1-3 ...
by jeb
06 Nov 2007 00:18
Forum: DOS Batch Forum
Topic: how to get the return value on variable
Replies: 10
Views: 16323

Hi jebesh_s,

try it with FOR /F or first with FOR /?.
The "Token" part only works with the /F option.

caio
jeb
by jeb
05 Nov 2007 15:53
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 12983

Hi raj_repos, why it give the result for the file which is not exists set ftime=0 for /F "tokens=2,3 delims=: " %%f IN ("%~t1") DO ( set /a ftime=1%%f * 60 + 1%%g - 700 ) Will result for a non existing file in ftime=0, because the for will do nothing. you can add ...
by jeb
30 Oct 2007 16:42
Forum: DOS Batch Forum
Topic: How to get last day of each month
Replies: 1
Views: 5512

Hi supervans, try this, it is a little bit simple, but it should work from Year 1604-03 till 2400-01 @echo off setlocal enableextensions setlocal enabledelayedexpansion call :initDateTable call :getDaysLength 2007 01 res echo 2007 01 has !res! days call :getDaysLength 2007 02 res echo 2007 02 has !r...
by jeb
25 Oct 2007 06:05
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 12983

Hi, start your batch like test.bat sap.txt on my system (WinXP) it works. Your errors can occour when the time (hours or minutes) are 08 or 09. Then the parser try to use these numbers as octal(the "0" prefix), but 08 and 09 aren't octal numbers, therefore it does not work every time. ok w...
by jeb
19 Oct 2007 13:26
Forum: DOS Batch Forum
Topic: How was I called?
Replies: 6
Views: 8203

Hi bbowler, you can try to use %0 if you start the batch (doIt.bat) from command line like doIt or doIt.bat you get doIt or doIt.bat if you call it from another batch call it like doIt.BaT So you can simple decide by the case of "BaT" how it is called. Not perfect, but perhaps better than ...
by jeb
19 Oct 2007 13:22
Forum: DOS Batch Forum
Topic: passing on unused parameters
Replies: 2
Views: 5245

Hi alasdair, you are right, %* is unaffected by shift But it exist another possible way. Not perfect, but better than %4 %5 %6 ... %9 %999 does not work, because only %1 .. %9 are defined %10 expands to "%1" and "0" The other way for /f "tokens=3*" %%a in ("%*"...
by jeb
19 Oct 2007 03:08
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 12983

Hi Raj, try this @echo off setlocal set now=0 for /F "tokens=1,2 delims=: " %%a IN ("%time%") DO ( set /a now=%%a*60 + %%b ) set ftime=0 for /F "tokens=2,3 delims=: " %%f IN ("%~t1") DO ( set /a ftime=%%f * 60 + %%g ) set /a minunte_diff = now-ftime if %minunt...
by jeb
17 Oct 2007 14:23
Forum: DOS Batch Forum
Topic: How was I called?
Replies: 6
Views: 8203

Hi bowler,

I dont know a way to detect this.

But perhaps you can use simple a special start parameter for the batch file,
if it is calling from another batch file.
by jeb
11 Oct 2007 14:39
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 12983

Hi raj_repos, take a look at the function library special :CmpFTime -- compares the time of two files, succeeds if condition is met, fails otherwise you have to change the compare mechanism a bit, but then you can test if a file is newer than 20minutes. How to send is another problem, i suppose you ...
by jeb
09 Oct 2007 04:32
Forum: DOS Batch Forum
Topic: MS-DOS: search & extract data from a file
Replies: 8
Views: 11963

Hi BatchIt, try this, it will seperate your log-infos into different files. @echo off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION set filename=nothing set /a counter=1 for /f "tokens=*" %%a IN (%~1) DO ( call :parseDay "%%a" filename call :splitLog "%%a" !...
by jeb
08 Oct 2007 15:16
Forum: DOS Batch Forum
Topic: MS-DOS: search & extract data from a file
Replies: 8
Views: 11963

Hi BatchIt, many questions ... 1. What do the following do? set filename=!filename:/=-! !variable! is nearly the same as %variable%, but it will be expanded in the moment of processing not in the moment of reading the line. This mechanism must be activated by SETLOCAL ENABLEDELAYEDEXPANSION else the...
by jeb
05 Oct 2007 15:01
Forum: DOS Batch Forum
Topic: A DOS command closing a "Windows Explorer" window?
Replies: 1
Views: 5497

Hi,

late answer, but an answer.

From Mark Russinovich (known as Sysinternals) found at
http://www.microsoft.com/technet/sysint ... skill.mspx

"Windows NT/2000 does not come with a command-line 'kill' utility."

Use PsKill from the PsTools to kill a process by process id or process name.
by jeb
05 Oct 2007 14:19
Forum: DOS Batch Forum
Topic: [solved] if A or B
Replies: 4
Views: 6876

Hi, yes there is a possible way. if you want to know if x=3 or y=4 try this. @echo off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION set x=%1 set y=%2 call :logic_or "%x%==3" "%y%==4" result if %result%==1 ( echo a or b is true ) else ( echo both wrong) goto:eof :::::...