Search found 1878 matches

by Aacini
17 Aug 2023 19:28
Forum: DOS Batch Forum
Topic: Command output formatting
Replies: 4
Views: 2078

Re: Command output formatting

I don't understand where "Resource Type" and the last part of "State" columns comes from... Antonio Hi, "Resource Type" is obtained combining "Local Resources" and "Cluster Resources" from original command, and "State" is obtained by combining "STATE" and "SERVER" from original command. Mmm... No.....
by Aacini
16 Aug 2023 15:10
Forum: DOS Batch Forum
Topic: Command output formatting
Replies: 4
Views: 2078

Re: Command output formatting

I don't understand where "Resource Type" and the last part of "State" columns comes from...

Antonio
by Aacini
10 Aug 2023 16:56
Forum: DOS Batch Forum
Topic: Putting BAT on Taskbar or inserting it to Tray
Replies: 4
Views: 5516

Re: Putting BAT on Taskbar or inserting it to Tray

Is there a way to pin to Taskbar of Windows 10 a BAT file or an LNK leading to it? Or to insert either of them to the Tray notification area? I tried pinning to Taskbar the cmd.exe and then setting its Target to C:\Windows\System32\cmd.exe "C:\MY SCRIPTS\test.bat" but it just opens CMD window with ...
by Aacini
01 Aug 2023 23:18
Forum: DOS Batch Forum
Topic: Timeout with GUI adjustments breaks its design after first second passes
Replies: 16
Views: 56377

Re: Timeout with GUI adjustments breaks its design after first second passes

Mmm... Perhaps I don't understand your request...

However, if you want to move the cursor to a previous line, you can do it via this trick...

Antonio
by Aacini
11 Jul 2023 07:49
Forum: DOS Batch Forum
Topic: Breaking PS1 line within BAT file [SOLVED]
Replies: 5
Views: 1806

Re: Breaking PS1 line within BAT file

Your "book of rules" failed in several points: My code have not "-Command" part and does not enclose the command in quotes. This is simpler and aids to avoid subtle errors. Your code left a blank line. If you want to insert a blank line, you have to put a caret at end (the same as all lines). You fo...
by Aacini
06 Jul 2023 15:09
Forum: DOS Batch Forum
Topic: Breaking PS1 line within BAT file [SOLVED]
Replies: 5
Views: 1806

Re: Breaking PS1 line within BAT file

You can review extensive examples of this method at this thread.

Antonio
by Aacini
23 Jun 2023 18:40
Forum: DOS Batch Forum
Topic: Is there a way to subtract 2 days from this batch file?
Replies: 5
Views: 14679

Re: Is there a way to subtract 2 days from this batch file?

I think you could solve your problem via the code posted at Generating consecutive dates.

You could also slightly modify the code in order to precisely decrement two days in a very simple way...

Antonio
by Aacini
21 Jun 2023 08:50
Forum: DOS Batch Forum
Topic: User defined prompt with dynamic data
Replies: 8
Views: 3330

Re: User defined prompt with dynamic data

Mmmm... This idea is pretty crazy! :D I reviewed the ANSI escape codes and found no way to generate an ENTER char. Indeed, there is no way to generate nothing other than the cursor position (embedded by the ESC codes), so I am afraid that your (crazy) idea to use the same name for a command would no...
by Aacini
16 Jun 2023 00:04
Forum: DOS Batch Forum
Topic: count characters of a input string in batch file
Replies: 4
Views: 2280

Re: count characters of a input string in batch file

There are a lot of different ways to solve this problem. This is another (simpler, I think) method: @echo off setlocal EnableDelayedExpansion rem Input the string set /P "string=" < test.txt echo The string: echo !string! echo/ set "digits=0123456789" set "letters=ABCDEFGHIJKLMNOPQRSTUVWXYZ" rem Sep...
by Aacini
12 Jun 2023 08:10
Forum: DOS Batch Forum
Topic: Fast Arithmetic Operations on Big Numbers
Replies: 1
Views: 1804

Fast Arithmetic Operations on Big Numbers

A Big Number is a number with more digits (usually much more digits) than the digits that usually can manage the programming language in a "natural" way. In Batch files the SET /A command manage integer arithmetic operations with 32 bits of precision that allows for numbers in the -2147483648..21474...
by Aacini
08 Jun 2023 19:16
Forum: DOS Batch Forum
Topic: nested IF statements, best practice (newbie question)
Replies: 5
Views: 1750

Re: nested IF statements, best practice (newbie question)

IMHO the first code is enough for this purpose. Of course, there is code that requires a deep nesting of commands/parentheses, but in this case I think that a deep nesting of IF commands makes the code unnecesarily complicated. Anyway, your second code don't works because two right parentheses are m...
by Aacini
08 Jun 2023 10:52
Forum: DOS Batch Forum
Topic: Combinations of N numbers in sets of K with R repeated elements
Replies: 9
Views: 3219

Re: Combinations of N numbers in sets of K with R repeated elements

Congratulations Antonio! I must admit that I don't understand what are you talking (writing) about but it was an interesting to read it. . . . Saso Mmm... Why is that? Although English is not my milk tongue, I try to write as clear as possible! When I have a doubt about my writting, I used a web tr...
by Aacini
02 Jun 2023 11:49
Forum: DOS Batch Forum
Topic: Combinations of N numbers in sets of K with R repeated elements
Replies: 9
Views: 3219

Re: Combinations of N numbers in sets of K with R repeated elements

6- "Brute force" further optimization After looking at the last method, I thought of a further optimization: Early cutoff values ​​with more than 2 iterations. In the last method above, there is a "not use" vector that is initialized in the FOR %%j loop with numbers on previously generated lines th...
by Aacini
31 May 2023 23:07
Forum: DOS Batch Forum
Topic: How to clear an array?
Replies: 9
Views: 4889

Re: How to clear an array?

. . . . . I like to do both ways! Depends on what I am doing. Let me explain set "this.x=" set "this.y=" set "this.degree=" set "this.color= and also, set "var[1]=foo" set "var[2]=bar" I think it depends on the data structure that I decide to go with. If it is an array I will be looping through, I ...
by Aacini
31 May 2023 20:25
Forum: DOS Batch Forum
Topic: Dos Batch Math Library
Replies: 68
Views: 92311

Re: Dos Batch Math Library

The same, written in a slightly different (and simpler, I think) way: @echo off setlocal EnableDelayedExpansion set "clamp= (leq=((low-x)>>31)+1)*low + (geq=((x-high)>>31)+1)*high + ^^^!(leq+geq)*x " set /A low=10, high=20 for /L %%i in (0,1,30) do ( set /A "x=%%i, out=%clamp%" echo %%i- !out! ) In ...