Search found 1723 matches

by Aacini
08 Nov 2021 10:56
Forum: DOS Batch Forum
Topic: Move errorlevel in For Statement
Replies: 5
Views: 745

Re: Move errorlevel in For Statement

You may use the trick described at end of this answer (under Table 5 - Commands or features that set the Exit Code):

Code: Select all

(for /f "usebackq delims=" %%i in (test.log) do move %%i "C:\path") || rem
if errorlevel 1 goto zero
echo success
pause
exit
:zero
echo nothing to move
pause
exit

Antonio
by Aacini
05 Nov 2021 10:54
Forum: DOS Batch Forum
Topic: netsh: capture multiple variables in one for loop
Replies: 13
Views: 902

Re: netsh: capture multiple variables in one for loop

For example: @echo off setlocal EnableDelayedExpansion for /F "tokens=1,2 delims=:" %%g in ('netsh interface ipv4 show interfaces "Ethernet 2"') do ( set "var=" for %%v in (%%g) do set "var=!var!_%%v" set "value=%%h" set "netsh[!var:~1!]=!value:~1!" ) set netsh Output: netsh[Anunciar_ruta_predetermi...
by Aacini
27 Oct 2021 17:31
Forum: DOS Batch Forum
Topic: Attention: Aacini Re: Resistor color calculator
Replies: 8
Views: 1038

Re: Attention: Aacini Re: Resistor color calculator

I don't know how to read Resistor Color Codes (I am not Electronic Engineer). The original question have these lines: set /a percent=(%color1%%color2% * %multiplier%) * %tolerance% set /a min=%color1%%color2% - %percent% set /a max=%color1%%color2% + %percent% So, for example, using Red-Red-Green-Si...
by Aacini
26 Oct 2021 06:39
Forum: DOS Batch Forum
Topic: Attention: Aacini Re: Resistor color calculator
Replies: 8
Views: 1038

Re: Attention: Aacini Re: Resistor color calculator

This is my Batch-file solution: @echo off setlocal EnableDelayedExpansion set "i=0" for %%D in ( Black:B:1 browN:N:10:0.0100 Red:R:100:0.0200 Orange:O:1000:0.0300 Yellow:Y:10000:0.0400 Green:G:100000:0.0050 bLue:L:1000000:0.0025 Violet:V:10000000:0.0010 grEy:E:100000000:0.0005 White:W:1000000000 gol...
by Aacini
26 Oct 2021 06:35
Forum: DOS Batch Forum
Topic: Attention: Aacini Re: Resistor color calculator
Replies: 8
Views: 1038

Re: Attention: Aacini Re: Resistor color calculator

Ok. The post that originated this challenge is this SO question . The OP required a calculation with a percent (2 decimals) and Gerhard suggested to use PowerShell instead because "it will be way simpler than cmd (batch-file)" . I don't agree and invited Gerhard to write a PS solution so we can comp...
by Aacini
25 Oct 2021 07:44
Forum: DOS Batch Forum
Topic: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??
Replies: 9
Views: 1089

Re: How to change Windows date from Gregorian date to Umm Al-Qura date Via batch file how that??

Hi, welcome to this forum. This is an advice for you: - In first place, be patient . The people in this forum are not here to review new posts and reply they ASAP. Give some hours, or even days, for a reply. - If you are new to this forum you should wait until a moderator approve your first post. - ...
by Aacini
17 Oct 2021 12:13
Forum: DOS Batch Forum
Topic: Detect echo state without temporary file
Replies: 14
Views: 7553

Re: Detect echo state without temporary file

Many years ago, in the time of command.com , I achieved to permanently disable the ECHO status by modifing one byte in command.com file. I am pretty sure that the same mod could be done in current cmd.exe. I don't know if this could be useful, or even related to this topic, but I remember this point...
by Aacini
16 Oct 2021 09:10
Forum: DOS Batch Forum
Topic: "Turtle Graphics" in Batch files!
Replies: 4
Views: 7455

Re: "Turtle Graphics" in Batch files!

Drawing open Recursive Curves with Turtle Graphics A Recursive or Fractal Curve is a figure generated from a base shape comprised of several straight line segments of the same size, like this one: https://i.ibb.co/bJhhdxw/1-Minkowski-Level-1.png For the purposes of this description, consider that t...
by Aacini
15 Oct 2021 22:30
Forum: DOS Batch Forum
Topic: "Turtle Graphics" in Batch files!
Replies: 4
Views: 7455

Re: "Turtle Graphics" in Batch files!

I updated the Batch Turtle Graphics package. I implemented the following subroutines: :setcolor color :setpc color echo ctx.strokeStyle="%~1"; >&3 exit /B :setwidth value :setpw value echo ctx.lineWidth=%1; >&3 exit /B :setbgcolor color echo document.body.style.backgroundColor="%~1"; >&3 exit /B :cl...
by Aacini
15 Oct 2021 13:08
Forum: DOS Batch Forum
Topic: String split question
Replies: 2
Views: 1703

Re: String split question

How do you identify the end of each part? It can not be a space, because the data have spaces. You may use the point and then rearrange the results a little. There are several ways to do such a process. I prefer this one: @echo off setlocal EnableDelayedExpansion set "string=1.no data 2.digital inpu...
by Aacini
13 Oct 2021 16:23
Forum: DOS Batch Forum
Topic: Open next menu in programm
Replies: 9
Views: 3094

Re: Open next menu in programm

I suggest you to carefully review SendMessage.exe: Access to advanced Windows features thread and check if such an auxiliary program can help you to solve your problem...

Antonio
by Aacini
09 Oct 2021 21:23
Forum: DOS Batch Forum
Topic: Output the results of two commands in parallel
Replies: 4
Views: 1975

Re: Output the results of two commands in parallel

If you say that 1.bat and 2.bat are executed in parallel, then you are wrong. The FOR/F command first run the command and then, after the command had finishef, output the results. 1.bat and 2.bat never run in parallel in this way...
by Aacini
27 Sep 2021 21:47
Forum: DOS Batch Forum
Topic: Efficient Array Management Operations in Batch files
Replies: 1
Views: 1655

Re: split string into substrings based on delimiter

I developed a couple new methods to simultaneously process two or more variables in a more efficient way. Let's start with this example: @echo off setlocal EnableDelayedExpansion set "names=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " set "values=1851174 310228712 23097674 165929174 9459159...
by Aacini
23 Sep 2021 21:48
Forum: DOS Batch Forum
Topic: Best way to pull out specifc lines from text file? JREPL?
Replies: 6
Views: 2215

Re: Best way to pull out specifc lines from text file? JREPL?

When I read this phrase: If using powershell commands via batch is an option, this becomes very trivial thanks to regex. I expected to see a "very trivial code" (compared vs a Batch file)... However, when I saw this: :# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/abo...