Search found 1620 matches

by Aacini
01 Sep 2019 11:07
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 15
Views: 12420

Re: Multi-line menu with options selection via DOSKEY

@Aacini I found a strange thing lately,with this script: @echo off :null PowerShell Exit($host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown').VirtualKeyCode); echo %errorlevel% goto null this can detect arrow keys, but only as %&'( (key 37,38,39,40) So far this is the closest thing I could find for arro...
by Aacini
30 Aug 2019 13:07
Forum: DOS Batch Forum
Topic: Bit Twiddling Hacks in Batch
Replies: 6
Views: 2700

Re: Bit Twiddling Hacks in Batch

Mmmm... These are my thoughts... Binary numbers and binary arithmetic is a tool that allows to perform arithmetic operations in a much efficient way than decimal operations, so is the right tool when speed is important in an application. Binary numeral system also allows to solve a problem in a much...
by Aacini
18 Aug 2019 04:53
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 15
Views: 12420

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

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

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

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

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: 15
Views: 12420

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

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.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 445
Views: 256939

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

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

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

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

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

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