Search found 914 matches

by jeb
19 Oct 2007 03:08
Forum: DOS Batch Forum
Topic: FINE THE FILE
Replies: 12
Views: 11253

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

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

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

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

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

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

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

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

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

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

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

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...
by jeb
30 Aug 2007 14:11
Forum: DOS Batch Forum
Topic: length should be 8 characters
Replies: 2
Views: 4757

Hi,

nice, but where do you have a problem?

Your batch results in

1) set str=12345678
8 character Qmanager Name is 12345678

2) set str=123456789abcd
You have exceeded more than 8 characters

Which results do you want? :?:
by jeb
30 Aug 2007 08:24
Forum: DOS Batch Forum
Topic: Quotes problem
Replies: 2
Views: 4800

Hi,

instead of using
ECHO "define !ville () '%cn%' !enddefine."> cityear_%%Y.sps

try this

ECHO define !ville ^(^) '%cn%' !enddefine.> cityear_%%Y.sps

Hope it helps
jeb