Search found 1042 matches

by jeb
17 Nov 2010 01:27
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 24
Views: 35699

Re: strLen boosted

Hi DosItHelp,

your solutions looks like the one of sowgtsoi, without the part of splitting down to 1024 chars.
It's more clear, but you can optimize the for-loop.

Because the maximum allowed string length is less than 8192 characters, this should always be enough

Code: Select all

for /L %%A in (12,-1,0) do


jeb
by jeb
16 Nov 2010 17:32
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 24
Views: 35699

Re: strLen boosted

@Amel27: Nice extension, simple but good.

I think only about to sync the read values, but your solution is much better.

jeb
by jeb
15 Nov 2010 12:23
Forum: DOS Batch Forum
Topic: compare multiple strings in same line
Replies: 2
Views: 4327

Re: compare multiple strings in same line

Hi akshunj, there is a simple answer, bool expressions are not supported by batch files. But you can use tricks. call :logic_or result "%string1%==%string2%" "%string1%==%string3%" "%string1%==%string3%" if %result%==1 set var=x goto :eof :logic_or <resultVar> expressio...
by jeb
15 Nov 2010 09:06
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 24
Views: 35699

Re: strLen boosted

Hi sowgtsoi, I'm always interested in solutions with pure batch, so your post is very interesting. I have one idea to improve your solution. With short strings (<=15 chars) you can use a lookup trick. set "str=%1" call :strLength result str echo %str% length is %result% goto :eof :strLengt...
by jeb
15 Nov 2010 06:33
Forum: DOS Batch Forum
Topic: How to remove string from another string in batch
Replies: 13
Views: 13413

Re: How to remove string from another string in batch

Hi,

at the command prompt I have to type

Code: Select all

myBatch.bat abc"&"^&def


I'm sure, it can be solved - yes we can :wink:
jeb
by jeb
15 Nov 2010 04:04
Forum: DOS Batch Forum
Topic: How to remove string from another string in batch
Replies: 13
Views: 13413

Re: How to remove string from another string in batch

Hi,

sorry amel27 but it fails with my standard password: abc"&"&def :wink:

It could be hard to accept %1 or %* with such a content.
Do you find a solution? :)

jeb
by jeb
26 Sep 2010 02:25
Forum: DOS Batch Forum
Topic: PLEASE HELP!!!I AM STUCKED!!!ESCAPE CHARACTER!!!
Replies: 3
Views: 3868

Re: PLEASE HELP!!!I AM STUCKED!!!ESCAPE CHARACTER!!!

I see a possible third way, so you don't need to escape anything (except " and %)

set "sql=select 'del ' || name from v$archived_log where sequence#>%MyVar% and applied='YES';"
setlocal EnableDelayedExpansion
echo !sql!


jeb
by jeb
23 Sep 2010 12:48
Forum: DOS Batch Forum
Topic: Special char in string
Replies: 16
Views: 13771

Re: Special char in string

hmm... very useful information, may be it is possible (?): The problem is how to use it, with set you can see it, but how to use it? Text after..: $x=(^^1^=^"%%^!^"^!2^!^"^!%%^") echo %$x% - works only if delayedExpansion is disabled, else you need two carets for escaping one ex...
by jeb
23 Sep 2010 11:54
Forum: DOS Batch Forum
Topic: Use of FOR in a batch file
Replies: 14
Views: 14941

Re: Use of FOR in a batch file

amel27 wrote:no! such code lead to an error:


Yes, you got me, i didn't test it. :)
It only works with a few number of lines.

And of course it's really bad style to use setlocal without endlocal.

jeb
by jeb
22 Sep 2010 08:55
Forum: DOS Batch Forum
Topic: Use of FOR in a batch file
Replies: 14
Views: 14941

Re: Use of FOR in a batch file

P.S. file names must not contains "!" symbol File names can contains also "!" symbols, if you change the code a little bit. @echo off setlocal enabledelayedexpansion set d1=c:\in set d2=d:\out echo ----- echo :1 2: echo ----- for /f "delims=" %%i in ('dir /b/a-d "...
by jeb
21 Sep 2010 16:17
Forum: DOS Batch Forum
Topic: Special char in string
Replies: 16
Views: 13771

Re: Special char in string

Hi pe.ft, My debugger is the echo command, so not sure of what happens. that's a good idea, but you should use echo on That can show you parts of the expansion. You could read "The Secrets Behind Batch File Interpretation" http://www.lingubender.com/forum/viewtopic.php?f=12&t=615 Or th...
by jeb
18 Sep 2010 15:20
Forum: DOS Batch Forum
Topic: How to make a batch file update itself
Replies: 7
Views: 13442

Re: How to make a batch file update itself

I would try to split it into two files. The first file, always look if there is an update and do the update if it is required. The second file is the worker. The system is safe, even if an update failed or you have a bug in your worker file. And you don't have the problem, that changing a batch file...
by jeb
18 Sep 2010 02:41
Forum: DOS Batch Forum
Topic: Make sure a variable starts with a specific character
Replies: 5
Views: 10185

Re: Make sure a variable starts with a specific character

And there is also a difference in the behaviour of set var="Content" vs. set "var=Content" The second case is an other syntax style, only allowed with ENABLEEXTENSIONS. A simple test shows set xx1="eins zwei" drei set "xx2=eins zwei" drei set xx Output: xx1=&q...
by jeb
15 Sep 2010 15:00
Forum: DOS Batch Forum
Topic: Check MAXIMUM RECORD LENGTH
Replies: 25
Views: 22251

Re: Check MAXIMUM RECORD LENGTH

Ok the solutions of !k and ghostmachine are good, but it's not batch. And this is the batch forum not the "which tool is better than cmd.exe" So there is the solution of aGerman, but ... it fails I only append one test line CODE1QWERTYYUIOPASDFGHJKLZXCCVVBNM 0 CODE2QWERTYYUIOPASDFGHJKLZ123...
by jeb
10 Sep 2010 11:09
Forum: DOS Batch Forum
Topic: Input unicode from a text file. (With gawk? ghostmachine4?)
Replies: 12
Views: 10623

Re: Input unicode from a text file. (With gawk? ghostmachine

If I try this if "し"=="こ" ( echo same ) ELSE ( echo Not same - unicode works ) It depends on, how I save the file. As ANSI, I got "same" As Unicode, I got "Not same - unicode works" And if I type or more the file I got if "Òüù"=="Òüô" ( I h...