Search found 4506 matches

by aGerman
12 Sep 2023 09:35
Forum: DOS Batch Forum
Topic: Stop visible countdown from constantly scrolling its content to bottom of PowerShell window
Replies: 5
Views: 17833

Re: Stop visible countdown from constantly scrolling its content to bottom of PowerShell window

PowerShell is a little off-topic here. However, I had a look at it and found that this behavior is unrelated to PowerShell and happens in Batch as well. It's by design, at least as long as you're running the shell in conhost. Windows Terminal does not override mouse scrolling. If you really want to ...
by aGerman
10 Sep 2023 03:58
Forum: DOS Batch Forum
Topic: How to interrupt script by closing the CMD window with any key?
Replies: 7
Views: 25209

Re: How to interrupt script by closing the CMD window with any key?

The only remaining bug related to timeout.exe that I know of is one of a couple "DefTerm" bugs caused by the Windows Terminal set the default terminal host. https://github.com/microsoft/terminal/issues/14499 However, that's probably not the case here because the timeout command would have always ret...
by aGerman
07 Sep 2023 11:11
Forum: DOS Batch Forum
Topic: How to interrupt script by closing the CMD window with any key?
Replies: 7
Views: 25209

Re: How to interrupt script by closing the CMD window with any key?

It's okay to use findstr. However, at least you need to check the errorlevel value it returned. @echo off &setlocal set "delay=5" :: prompt without new line <nul set /p "=PRESS ANY KEY TO CANCEL within the next %delay% seconds ... " :: check if the output ends with 0 that isn't preceded by another d...
by aGerman
06 Aug 2023 14:04
Forum: DOS Batch Forum
Topic: Add A Second Question to a Window?
Replies: 1
Views: 4496

Re: Add A Second Question to a Window?

Seeing a textual interface and a graphical interface together does always give me the shivers. It's like seeing a man walking on the moon. Funny for sure, but at the same time it's getting pretty clear that the moon isn't the right environment for mankind. This having said - No, there isn't any poss...
by aGerman
01 Jan 2023 12:06
Forum: DOS Batch Forum
Topic: Bug in vt101 Alternate Screen Buffer?
Replies: 9
Views: 25378

Re: Bug in vt101 Alternate Screen Buffer?

I looked it up. Seems this has been fixed with update 1809 (10.0.17763), finally rolled out on November 13, 2018.
Reference: https://github.com/microsoft/terminal/issues/162

Steffen
by aGerman
01 Jan 2023 06:14
Forum: DOS Batch Forum
Topic: Help with if / loop and variables
Replies: 9
Views: 24250

Re: Help with if / loop and variables

Why is it necessary to read the whole file into an associative array then? Directly use the user input along with FIND or FINDSTR in order to check whether it occurs in the file.

Steffen
by aGerman
31 Dec 2022 10:09
Forum: DOS Batch Forum
Topic: Help with if / loop and variables
Replies: 9
Views: 24250

Re: Help with if / loop and variables

Try to use a FOR /F loop along with FINDSTR /N. Steffen @echo off &setlocal :: read the file using FINDSTR /N that outputs the lines prefixed with line number and colon :: preconditions: the file doesn't contain any blank lines, lines don't begin with a colon :: the output is tokenized using the col...
by aGerman
14 Nov 2022 13:46
Forum: DOS Batch Forum
Topic: findstr with regex to find characters with MSB bit set
Replies: 6
Views: 12981

Re: findstr with regex to find characters with MSB bit set

It's not too complicated.

Code: Select all

cmd /c jrepl.bat "^[\x09\x20-\x7F]*$" "" /N 1 /R 0 /XSEQ /F "test.txt"
You can add more valid characters right after \x7F. Use the char codes of Windows-1250 in this case. (FWIW I started with \x09 because I guess you don't want tab characters reported.)

Steffen
by aGerman
14 Nov 2022 11:19
Forum: DOS Batch Forum
Topic: findstr with regex to find characters with MSB bit set
Replies: 6
Views: 12981

Re: findstr with regex to find characters with MSB bit set

but it is not important for the test because bit 7 is set. Oh, I've been under the impression that you wanted to exclude those characters since you have them in the list of "valid characters". Hmm... Is there a solution for that? Yes and no. Yes - You may use 3rd party utilities like SED or GRAP. Y...
by aGerman
13 Nov 2022 16:00
Forum: DOS Batch Forum
Topic: findstr with regex to find characters with MSB bit set
Replies: 6
Views: 12981

Re: findstr with regex to find characters with MSB bit set

NOTEPAD shows ANSI My guess is that the default ANSI code page is Windows-1250 in your case. However, ... Č: 0xAC Š: 0xE6 Ž: 0xA6 č: 0x9F š: 0xE7 ž: 0xA7 --- are character codes for CP 852. I really doubt that your test.txt file is CP 852 encoded though. Could you shed some light on that? Besides o...
by aGerman
11 Nov 2022 10:39
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10093

Re: Timeout via for loop

Disabling echo I see the script stuck at if defined err goto :errordisplay Huh? Provided that the :errordisplay label exists, this shouldn't ever have happened. set "err=" for /f "delims=|" %%a in (errorlist.txt) do ( for /f "delims=|" %%b in (''2^>nul findstr /C:"%a" "%cd%\Logs\*.*"') do ( set "er...
by aGerman
09 Nov 2022 16:16
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10093

Re: Timeout via for loop

I think I understood what you're after.

Code: Select all

set "err="
for /f "delims=|" %%a in (errorlist.txt) do (
  findstr /C:"%a" %cd%\Logs\*.*
  if not errorlevel 1 set "err=1"
)
if defined err goto :errordisplay
by aGerman
08 Nov 2022 17:57
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10093

Re: Timeout via for loop

OK but what would be the FINDSTR pattern then? As to my understanding you already search all log files that have been created.

Steffen
by aGerman
08 Nov 2022 17:45
Forum: DOS Batch Forum
Topic: Finding an error
Replies: 10
Views: 8454

Re: Finding an error

NP++ is just completely misinterpreting your frame characters as shown in your other thread: https://www.dostips.com/forum/viewtopic.php?f=3&t=10559&p=67713#p67713 Don't worry, it's just weirder than other editors would interpret them. They would most likely recognize ANSI which is Windows-1252 in y...
by aGerman
08 Nov 2022 14:35
Forum: DOS Batch Forum
Topic: Finding an error
Replies: 10
Views: 8454

Re: Finding an error

Looks like NP++. To ensure really every line ends with CRLF, double click on "Windows (CR LF)" down in the status bar, turn it into "UNIX (LF)", and back to "Windows (CR LF)". If this doesn't help I'm afraid I have no further idea.

Steffen