Search found 973 matches

by jeb
29 Nov 2020 11:32
Forum: DOS Batch Forum
Topic: Is it possible restore overwrited contents like F7-Selection?
Replies: 2
Views: 821

Re: Is it possible restore overwrited contents like F7-Selection?

But there was a bug Bug in vt101 Alternate Screen Buffer?
- Crashes on company-managed computer with Windows 10.0.16299.1625
- Works fine on another one managed by me, with Windows 10.0.19041.84
by jeb
18 Nov 2020 08:04
Forum: DOS Batch Forum
Topic: About variable expansion
Replies: 8
Views: 1336

Re: About variable expansion

Hi barnabe0057, you used the variable "var" instead of "string". Your replace logic can't work, because if you found two stars at a position you append to the current result a star, else you append the character at the position, so you effectivly ALWAYS append the character at the current position. ...
by jeb
18 Nov 2020 06:31
Forum: DOS Batch Forum
Topic: ANSI Escape Code does not works with (start) command
Replies: 5
Views: 1207

Re: ANSI Escape Code does not works with (start) command

Hi, same failure on my system! Tested on Microsoft Windows [Version 10.0.17763.1397] That's 1809 (What a stupid naming chaos) But I simplified the code a bit @echo off for /F %%A in ('echo prompt $E ^| cmd') do set "ESC=%%A" cls echo %ESC%[2;2H * [2,2] Works ( start "" https://example.com echo %ESC%...
by jeb
18 Nov 2020 06:12
Forum: DOS Batch Forum
Topic: PSU auto shutdown
Replies: 2
Views: 881

Re: PSU auto shutdown

Hi juleklO, your question is a bit off topic for batch files. Btw. The "GreenCell PowerProof 2000VA" is an UPS not a PSU. Professional PSU's have an IPMI or redfish interface. Many UPS claims to have an interface, but they differ from each vendor and model in many cases it's simply crap, undocumente...
by jeb
02 Nov 2020 04:27
Forum: DOS Batch Forum
Topic: Nesting statement if ()==() ( ) gives an error
Replies: 2
Views: 1044

Re: Nesting statement if ()==() ( ) gives an error

Hi BoQsc, avoid enclosing anything with parenthesis in the IF's, at all. Enclosing should always be done with quotes. IF "c" == "c" ( echo test IF "b" == "b" ( echo yes ) ) Using quotes, avoids problems with spaces in the value (in case of variables) and also special characters cna be used. Parenthe...
by jeb
29 Oct 2020 07:58
Forum: DOS Batch Forum
Topic: A killer : in a comment
Replies: 15
Views: 1990

Re: A killer : in a comment

And this behaviour is a useful feature!

Code: Select all

%LOAD_ONLY_ONCE:call "%~dp0\libBase.cmd" := %
If LOAD_ONLY_ONCE is undefined, the call is executed and there the LOAD_ONLY_ONCE macro is defined.
Any further such line will execute only the macro.

jeb
by jeb
02 Aug 2020 12:01
Forum: DOS Batch Forum
Topic: FOR variable %%A in macro definition gets overridden when script is called by other script within FOR loop
Replies: 15
Views: 2605

Re: FOR variable %%A in macro definition gets overridden when script is called by other script within FOR loop

Thanks Maylow for the question :D I had the same problem some time ago, and it's because I built also a batch macro library :) a) It's expected behaviour b) It can be solved, It can be solved even that you can define macros inside any FOR-Loop and independent of delayed mode It doesn't need setlocal...
by jeb
16 Jul 2020 12:14
Forum: DOS Batch Forum
Topic: Assign cmdline output to var with inner cmdline quotes?
Replies: 10
Views: 2342

Re: Assign cmdline output to var with inner cmdline quotes?

Hi pstein, did you test your code with the macro from SO:Assign output of a program to a variable ? It should work without any modifications. The FOR/F loop uses a single quote and a double quote for /F "delims=" %%O in ('"%%~2 | findstr /N ^^"') do ( %\n% --- For beter visibility: ... %%O in ( ' " ...
by jeb
13 Jul 2020 01:32
Forum: DOS Batch Forum
Topic: Assign cmdline output to var with inner cmdline quotes?
Replies: 10
Views: 2342

Re: Assign cmdline output to var with inner cmdline quotes?

Hi T3rry, I suppose the $set is a macro, perhaps the one from SO: Assign output of a program to a variable using a MS batch file . But even then it should work with spaces, I tested it and it works for me with: call :initMacro %$set% output=""with space\calc.exe" -parm1 "https://www.foobar.com/web/p...
by jeb
22 Jun 2020 00:43
Forum: DOS Batch Forum
Topic: caret removes the first command after opening parenthesis if its concat'd to the first token of command without space
Replies: 4
Views: 1709

Re: caret removes the first command after opening parenthesis if its concat'd to the first token of command without spac

Btw. the @ has also sme impact.

Code: Select all

@echo on
cls
(
echo Start

@ ec^
ho #1: Works
@ec^
ho #2: Fails

@@^
@@ ec^
ho #3: Works

xyz@@^
@@ ec^
ho #4: Works
)

echo End
by jeb
22 Jun 2020 00:38
Forum: DOS Batch Forum
Topic: Pass multiple lines(through stdin) from batch to powershell
Replies: 4
Views: 1556

Re: Pass multiple lines(through stdin) from batch to powershell

Hi lockedscope, you found already the relevant posts on SO. Pipes (mostly) creates a child cmd.exe instance on both sides. The command itself will be executed in the child instance, but the first expansion occurs in the parent instance. The parent instance will use the percent expansion, but the del...
by jeb
22 Jun 2020 00:30
Forum: DOS Batch Forum
Topic: How batch parsing phases work?
Replies: 4
Views: 1661

Re: How batch parsing phases work?

Hi,

your first analysis is correct, but not the second one.

the line: set c=^^^!text^^^!
assigns !text! to c

Therefore the line: echo %c%

only has to expand !text! to "my"
by jeb
22 Jun 2020 00:20
Forum: DOS Batch Forum
Topic: caret removes the first command after opening parenthesis if its concat'd to the first token of command without space
Replies: 4
Views: 1709

Re: caret removes the first command after opening parenthesis if its concat'd to the first token of command without spac

Hi lockedscope, nice finding :!: I didn't knew that and never tested it. The rule seems to be: - In paremthesis: - If a caret+line feed splits the command token (usually the first token), then only the part after the last LF is used - This rule is true for any position in the parenthsis, not only th...
by jeb
16 Jun 2020 00:09
Forum: DOS Batch Forum
Topic: How batch parsing phases work?
Replies: 4
Views: 1661

Re: How batch parsing phases work?

Hi lockedscope, it's quite correct. But my first rule is: Always monitor variables unmodified :!: You can use delayed expansion for that or the SET command, but never percent expansion, that only confuses the result 8) If you add set b after the line set "b=%a%" you see that the content of <b> is "^...
by jeb
15 Jun 2020 07:17
Forum: DOS Batch Forum
Topic: Dynamic loop code over multiple lines causes extra quotes
Replies: 7
Views: 1958

Re: Dynamic loop code over multiple lines causes extra quotes

Hi lockedscope, So, how could that 10/11 carets works? The problem is, in your case there are multiple escape phases! Start: "for... "^^^^^^^^^^!text^^^^^^^^^^! ...." phase2: "for... "^^^^^!text^^^^^! ..." phase5: "for... "^^!text^^! ..." CALL doubling: "for... "^^^^!text^^^^! ..." Restart parsing p...