Search found 944 matches

by einstein1969
17 Oct 2013 18:48
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Re: Increment an integer without SET

I'm using at the moment few external commands You can't avoid it. What I actually meant is that you could use COPY instead of XCOPY if you simply have to copy a file. Or that you could apply FINDSTR to a file / a set of files instead of applying it to each line / each file separately. The reason wh...
by einstein1969
17 Oct 2013 15:21
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Re: Increment an integer without SET

Thank you for the wise suggestion, but I'm using at the moment few external commands. I'll probably have to revise the logic to break down the problem of declining performance. This script is phenomenal! It will take me a double cup of coffee to figure out how do you generate the list. Anyway back t...
by einstein1969
17 Oct 2013 15:00
Forum: DOS Batch Forum
Topic: StrLen +Set Help
Replies: 8
Views: 6146

Re: StrLen +Set Help

thanks jeb. I have modified with parentesis () e other stuff and have incremented one by one char this is the result: E:\x264\provini>tmp4 s=X SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows strlen[st1]:4096 strlen[st2]:4091 strlen[s]:8187 calculate=8187 Size of s.dat is 8187. 17/10/2013 18...
by einstein1969
17 Oct 2013 09:44
Forum: DOS Batch Forum
Topic: center text with echo
Replies: 6
Views: 13538

Re: center text with echo

or more simple, need more test: @echo off & setlocal enableDelayedExpansion set /a size=80-1 & rem screen size minus one set s=b for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! " set s=!s:~1,%size%!& echo(!s! set s=bla for /L %%# in (1,2,!...
by einstein1969
17 Oct 2013 09:08
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Re: Increment an integer without SET

I can't see the sense of avoiding set /a For performance reason (if we can do it) If you are looking for performance then why are you using batch? Even an interpreted basic program will blow batch out of the water for speed. you are right! I could certainly do the same thing in assembler or any oth...
by einstein1969
17 Oct 2013 08:34
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Re: Increment an integer without SET

jeb wrote:I can't see the sense of avoiding set /a :?:


For performance reason (if we can do it)
by einstein1969
17 Oct 2013 08:28
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Re: Increment an integer without SET

Ok. I have formuled the question wrong! You are right! I use this code for change the content of string: one_char_change: setlocal EnableDelayedExpansion set s=0123456789 set Pos=4 set newvalue=# set /a Pos2=Pos+1 set s=!s:~0,%Pos%!!newvalue!!s:~%Pos2%! echo !s! rem OR set s=0123456789 set Pos=4 set...
by einstein1969
17 Oct 2013 04:43
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 10471

Increment an integer without SET

hi to all, Does anyone know how to increment a variable that contains the representation of an integer? I would suffice the increase of 1 or a few units I would avoid the use of the SET (or the SET / A) and if possible use only one or two expansions (or if there is a chance even three). So that is f...
by einstein1969
17 Oct 2013 03:58
Forum: DOS Batch Forum
Topic: StrLen +Set Help
Replies: 8
Views: 6146

Re: StrLen +Set Help

Hi einstein1969, you found the line length limitation. Each line in batch can only be 8191 characters long (more or less). So this produces also the result that the content of a variable can't be longer than this limit. jeb Thanks jeb for replay. But... where is the problem? result: 4096 4089 8191 ...
by einstein1969
16 Oct 2013 12:47
Forum: DOS Batch Forum
Topic: StrLen +Set Help
Replies: 8
Views: 6146

StrLen +Set Help

hi, I don't understand where i wrong @echo off & setlocal enabledelayedExpansion set "st1=" For /L %%# in (1,1,4096) do set "st1=!st1!A" call :strlen st1 len1 echo !len1! set "st2=" For /L %%# in (1,1,4089) do set "st2=!st2!_" call :strlen st2 len2 echo !l...
by einstein1969
15 Oct 2013 17:29
Forum: DOS Batch Forum
Topic: Function F2I Problem with negative
Replies: 8
Views: 12405

Re: Function F2I Problem with negative

"tokens=* delims=0" removes existing leading zeros. That's all. There is another fact that you should be aware though: if the value in !i! is 0 then then it will be removed completely Regards aGerman OK. there is a case that there are only 0. But the SET is executed with %%z="" ...
by einstein1969
15 Oct 2013 17:11
Forum: DOS Batch Forum
Topic: For /F problem with double quote and space and other char...
Replies: 4
Views: 3554

Re: For /F problem with double quote and space and other cha

aGerman wrote:
The third seems faster.

Maybe. But does it really matter :?

The question is if you're aware that all of them are working completely different?
Test again with

Code: Select all

set "var="Say "hello" to the World""


Regards
aGerman


I have seen :?
by einstein1969
15 Oct 2013 16:35
Forum: DOS Batch Forum
Topic: Function F2I Problem with negative
Replies: 8
Views: 12405

Re: Function F2I Problem with negative

1) On line 2 i remove the sign but in line 3 i use %f:*.=% for removing the part before the decimal. The question is that is in a block () and the expansion should not work, i think... Why don't you use exclamation marks instead of percent signs? 2) on line 4 the FOR that remove the leading zero , ...
by einstein1969
15 Oct 2013 16:04
Forum: DOS Batch Forum
Topic: For /F problem with double quote and space and other char...
Replies: 4
Views: 3554

Re: For /F problem with double quote and space and other cha

I'm not quite certain what you're looking for Sounds like set "var="Hello World"" echo %var% set "var=%var:"=%" echo %var% echo %var: =% but sounds also like set "var="Hello World"" echo %var% for /f "delims=" %%i in ("%var%"...
by einstein1969
15 Oct 2013 11:23
Forum: DOS Batch Forum
Topic: For /F problem with double quote and space and other char...
Replies: 4
Views: 3554

For /F problem with double quote and space and other char...

Hi, I'm going crazy with the special syntax of the For / F! I have read this HOW TO: FOR /F Disabling EOF or using a quote as delim but with no result I have a var that can contain a space and can use double quote at sorround. Can the for /f eliminate space and double quote and leave the rest? thank...