Search found 982 matches

by jeb
31 May 2021 04:14
Forum: DOS Batch Forum
Topic: Unexpected DOS shell expansion of %~n1 and %~x1
Replies: 4
Views: 251

Re: Unexpected DOS shell expansion of %~n1 and %~x1

Hi,

for me it was unexpected, that wildcards are expanded, if the content is in %1..%9 or even in a FOR meta variable.

Code: Select all

@echo off
echo %%1=%1         - no wildcard expansion
echo %%~1=%~1     - no wildcard expansion
echo %%~n1=%~n1 - wildcard expansion
echo %%~f1=%~f1    - wildcard expansion
by jeb
19 May 2021 00:31
Forum: DOS Batch Forum
Topic: Batch coloring not working after git output
Replies: 2
Views: 311

Re: Batch coloring not working after git output

Hallo Bleifuss,

I just tested it on Win10 and it worked,
but I'm sure I saw a similar post about broken escape sequences after some commands.
But as always I can't find the post anymore.

jeb
by jeb
12 Apr 2021 09:17
Forum: DOS Batch Forum
Topic: MS-DOS 6.22 variable trimming
Replies: 3
Views: 1070

Re: MS-DOS 6.22 variable trimming

After review your original problem, I see it's considerably easier, because the output of your program can be used directly. I assume, the output always begins with "CPU_0" You only need two files (GETCPUID.bat and ADD.BAT) GETCPUID.bat @echo off REM Trampoline function for %%L in (%0) do if "%%L"==...
by jeb
02 Apr 2021 06:23
Forum: DOS Batch Forum
Topic: MS-DOS 6.22 variable trimming
Replies: 3
Views: 1070

Re: MS-DOS 6.22 variable trimming

Hi cajunjon, you could split your problem into smaller problems and use some helper files. The list of your problems You need to assign the program output to a variable Split a string into parts substring works only for strings without spaces or other delimiters A variable can't contain an equal sig...
by jeb
19 Feb 2021 01:46
Forum: DOS Batch Forum
Topic: Apostrophe at beginning of file name
Replies: 6
Views: 2032

Re: Apostrophe at beginning of file name

Hi, the error occurs after the file was read, because the FOR loop tries to read the next file! @echo off echo this is myfile>myfile.txt echo this is myapo> "'myapo.txt" echo this is myapo1> "'myapo1.txt" for /F "usebackq delims=" %%G IN ("'myapo.txt" "myfile.txt" ) do echo #1 %%G for /F "usebackq d...
by jeb
17 Feb 2021 03:30
Forum: DOS Batch Forum
Topic: Problem with variable Drive setup for XP/W98SE
Replies: 17
Views: 4003

Re: Problem with variable Drive setup for XP/W98SE

Hi miskox, echo %cd% tested, it works in XP, but not in w98. That was expected, because XP has nearly the same features and bugs like W10. It could be a good solution to write different code for XP and W98 and detect which part has to be used. Something like @echo off >NUL echo dummy & goto :XP REM ...
by jeb
16 Feb 2021 06:00
Forum: DOS Batch Forum
Topic: Problem with variable Drive setup for XP/W98SE
Replies: 17
Views: 4003

Re: Problem with variable Drive setup for XP/W98SE

You could try this one, it works on win98 (tested) and should work on XP, too @echo off if "%1" == "" goto :main goto %1 :main set drv=unknown %COMSPEC% /c %0 :getdrv > drvtmp.bat call drvtmp.bat echo my drive is: %drv% goto :eof :getdrv prompt set drv=$N echo on %=must be empty=% @echo off :eof
by jeb
11 Feb 2021 05:19
Forum: DOS Batch Forum
Topic: Using VT100 input sequences
Replies: 2
Views: 1388

Re: Using VT100 input sequences

Hi Darvil,

take a look at Attempt to catch arrow keystrokes.
There seems no way to detect the arrow keys with pure batch, but it's possible wit powershell and Aacini built some good helper programs for that.

jeb
by jeb
10 Feb 2021 10:19
Forum: DOS Batch Forum
Topic: Cmd.exe bug with special characters
Replies: 2
Views: 1478

Re: Cmd.exe bug with special characters

Hi,

as JFL already said, the echo %0 is the problem.

If you want to see the content without problems, you could use the REM technique.

Code: Select all

@echo off
echo Test

echo on
REM # %0 #
@echo off

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

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

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

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

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

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

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