Search found 917 matches

by jeb
25 Oct 2007 06:05
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 11396

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: 7140

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: 4673

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: 11396

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: 7140

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: 11396

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: 10718

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: 10718

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: 4961

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: 6098

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 :::::...
by jeb
05 Oct 2007 14:09
Forum: DOS Batch Forum
Topic: MS-DOS: search & extract data from a file
Replies: 8
Views: 10718

Hi, try this. It parse the file, and per day it creates a new file with filename like 8-20-07.part @echo off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION set filename=nothing for /f "tokens=*" %%a IN (%~1) DO ( call :parseDay "%%a" filename echo %%a >> !filename! ) g...
by jeb
10 Sep 2007 02:34
Forum: DOS Batch Forum
Topic: how can i get position of a character(s) in a string?
Replies: 15
Views: 21910

Hi all, your Version set "str=!%~1!" -- str is now "This is the example" set "str=!str:%~2=@@@@! -- str is now "This is @@@@ example" set "str=%str:@@@@="&REM % -- this finally truncates the string, i.e. before executing it evaluates to: -- set "...
by jeb
02 Sep 2007 14:46
Forum: DOS Batch Forum
Topic: how can i get position of a character(s) in a string?
Replies: 15
Views: 21910

Hi, nice trick to truncate the string. But here is a little bit better version, that work also for (should work for all strings) set "s=This@@@@ is the example." call:findString s "the" pos :findString -- returns the zero based postion of one string in another string of maximum l...
by jeb
30 Aug 2007 16:33
Forum: DOS Batch Forum
Topic: string should be only alphanumeric
Replies: 1
Views: 4704

Hi, nearly the same like :isNumeric. ::************************ :isAlphaNumeric setlocal set rest=_ for /f "delims=0123456789abcdefghijklmnopqrstuvwxyz" %%a in ("%~1") do set rest=_%%a set return=false if "%rest%"=="_" set return=true ( endlocal if "%~2&q...
by jeb
30 Aug 2007 15:13
Forum: DOS Batch Forum
Topic: should be numeric only
Replies: 1
Views: 4327

isNumeric function

Hi Sivaram, this should solve it. @echo off set myNum=%1 call :isNumeric %myNum% result echo %result% goto :eof ::************************ :isnumeric setlocal set rest=_ for /f "delims=0123456789" %%a in ("%~1") do set rest=_%%a set return=false if "%rest%"=="_&quo...