Search found 923 matches

by jeb
05 Oct 2007 14:19
Forum: DOS Batch Forum
Topic: [solved] if A or B
Replies: 4
Views: 6190

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

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

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

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

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

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

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

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