Search found 1603 matches

by Aacini
18 Aug 2019 04:53
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 11
Views: 5571

Re: Multi-line menu with options selection via DOSKEY

@Szecska, As I said before , you may get the same result in a much simpler way using a choice /N /C 123450 command; I don't see any reason to use the replace.exe method here... IMHO these replace.exe-based examples should be moved to the replace.exe explanation method thread. Those "option selection...
by Aacini
09 Aug 2019 20:37
Forum: DOS Batch Forum
Topic: SORT Order not working correction
Replies: 8
Views: 637

Re: SORT Order not working correction

Are you using SORT not for sorting, but to get maximum and minimum? And two times ? :shock: Strange thing... Why not keep things simple? Try: @echo off setlocal set /A max=-99999, min=99999 for /F "usebackq tokens=5,6 delims=|" %%a in ("%%~F") do ( if %%a gtr !max! set "max=%%a" if %%a lss !min! set...
by Aacini
09 Aug 2019 08:19
Forum: DOS Batch Forum
Topic: Find, replace and move rows with matches and mismatches
Replies: 4
Views: 389

Re: Find, replace and move rows with matches and mismatches

This new version should run faster: @echo off setlocal EnableDelayedExpansion rem Load strings to search from parameters (modify this point if required) set n=0 for %%a in (%*) do ( set /A n+=1 set "S!n!=%%a" ) (for /F "tokens=1* delims=," %%a in (input.txt) do ( set "this=%%a" & set "rest=%%b" set ...
by Aacini
09 Aug 2019 07:08
Forum: DOS Batch Forum
Topic: SORT Order not working correction
Replies: 8
Views: 637

Re: SORT Order not working correction

Of course! SORT command sorts lines . In other words, sorts strings , and AC_41110|FH_00000|DP_000|CO_11|9|FY19|budget|-3477456.18 string is "larger" (that is, goes after) than AC_41110|FH_00000|DP_000|CO_11|12|FY19|budget|-2968880.0 string (because the "9" is larger than the "1"). Antonio
by Aacini
07 Aug 2019 22:53
Forum: DOS Batch Forum
Topic: Find, replace and move rows with matches and mismatches
Replies: 4
Views: 389

Re: Find, replace and move rows with matches and mismatches

Your "question" (a task request, really) have a lot of confusing or incomplete details. I strongly suggest you to carefully read the first sticky post of this forum... However, this code works: @echo off setlocal EnableDelayedExpansion set n=0 for /F "delims=" %%a in (input.txt) do ( set /A n+=1, i=...
by Aacini
11 Jul 2019 22:15
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 11
Views: 5571

Re: Multi-line menu with options selection via DOSKEY

I reviewed this program and fixed the problem about the reinitialization of DOSKEY history. It works correctly now. Then, I wrote an example of a menu to start real programs. When the programs are console applications, everything is OK. However, when the programs are GUI applications, then may be a ...
by Aacini
28 Jun 2019 12:15
Forum: DOS Batch Forum
Topic: Cmdgfx - draw 3d and graphic primitives (polygons,circles etc) in cmd window (now with 24-bit RGB support!)
Replies: 105
Views: 36970

Re: Cmdgfx - draw 3d and graphic primitives (polygons,circles etc) in cmd window (now with 24-bit RGB support!)

Wow! The writing of text is fantastic! This remembers me my old method to write text in pixel mode. Where do you get the definition of the raster fonts, so you can read them?

Antonio
by Aacini
21 Jun 2019 15:27
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.3 - regex text processor with support for text highlighting and alternate character sets
Replies: 437
Views: 191489

Re: JREPL.BAT v8.2 - regex text processor with support for text highlighting and alternate character sets

Mmmm... If you may change the format of both input files, then there is a very simple solution: target.txt: There is !a! apple Now there were !b! apples before In the beginning there were !c! apples definition.txt: a=one b=two c=three test.bat: @echo off setlocal EnableDelayedExpansion rem Read stri...
by Aacini
05 Jun 2019 08:54
Forum: DOS Batch Forum
Topic: Batch file runs differently when executed line by line
Replies: 6
Views: 1588

Re: Batch file runs differently when executed line by line

At this topic there is a detailed description of the differences of execute commands inside a Batch.bat file vs directly at the command line. Perhaps you may want to review it, but be warned that such a topic quickly changes into an esoteric subject! :shock: :wink:

Antonio
by Aacini
04 May 2019 10:50
Forum: DOS Batch Forum
Topic: How to preserve exact number of space characters after split by for
Replies: 2
Views: 401

Re: How to preserve exact number of space characters after split by for

Don't use usebackq switch and enclose the variable in quotes:

Code: Select all

@echo off

:test2
setlocal DisableDelayedExpansion

set "line1=   abc   #   %%var1%%   #   ^!var2^!"


for /f "delims=# tokens=1,2,3*" %%i in ("%line1%") do (
	echo {%%i}
	echo {%%j}
	echo {%%k}
)

endlocal
goto :eof
Antonio
by Aacini
27 Apr 2019 06:28
Forum: DOS Batch Forum
Topic: Color Ascii Art
Replies: 8
Views: 8434

Re: Color Ascii Art

@lylalandry, I clearly explained the process in my post... Can't you see the same paragraphs I wrote? :? ..... I searched the web for an Image-to-Ascii Art conversion program. After a short search, I got Ascii Generator 2 . I have not time to do extensive searching and testing, so I don't know if th...
by Aacini
26 Apr 2019 09:43
Forum: DOS Batch Forum
Topic: using for loop and delims to extract a substring
Replies: 6
Views: 731

Re: using for loop and delims to extract a substring

Code: Select all

@echo off
setlocal

set "$html=<source src="http://videos.dummysite.com/videos/video01.mp4" type="video/mp4"/>"

set "x=%$html: =" & set "%"

echo %src:~1,-1%
Antonio
by Aacini
08 Apr 2019 10:35
Forum: DOS Batch Forum
Topic: Cut text after nth comma using batch script
Replies: 1
Views: 342

Re: Cut text after nth comma using batch script

Another way to say the same thing is that you want the first and second tokens delimited by comma, isn't it?

Code: Select all

for /F "tokens=1,2 delims=," %%a in ("theFile.txt") do echo %%a,%%b
Antonio
by Aacini
05 Apr 2019 09:55
Forum: DOS Batch Forum
Topic: how to make an array by function and by local variable of the function
Replies: 5
Views: 825

Re: how to make an array by function and by local variable of the function

@echo off set /a n=99 call :test3 ret echo show array: echo %ret.Array[0]% echo %ret.Array[1]% echo %ret.Array[2]% echo %ret.Array[3]% ECHO Press any key to close the windows... pause>NUL goto :eof :test3 setlocal for /L %%i in (0,1,3) do set "%~1.Array[%%i]=V%%i" set localEnv=1 for /F %%v in ('set...
by Aacini
05 Apr 2019 09:44
Forum: DOS Batch Forum
Topic: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33
Replies: 9
Views: 1239

Re: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33

... and you also should read the very first post in this forum... @echo off setlocal EnableDelayedExpansion (for /F "delims=" %%a in (input.txt) do ( set "line=" for %%b in (%%a) do ( set "num=%%b" set "line=!line!\x!num:~0,2!\x!num:~2! ) echo !line! )) > output.txt move /Y output.txt input.txt Anto...