Search found 1878 matches

by Aacini
23 Mar 2023 19:51
Forum: DOS Batch Forum
Topic: Read window line from parent cmd without writing to file
Replies: 6
Views: 2551

Re: Read window line from parent cmd

Accordingly to your last test, this should work:

Code: Select all

for /f "usebackq tokens=5 delims=: " %%i in ('pstat.exe ^| findstr /i "memory"') do echo %%i
Note that you changed the "backtit" ("`" character) by apostrophe...

If this not works, remove the usebackq option from FOR /F switch.

Antonio
by Aacini
14 Mar 2023 13:01
Forum: DOS Batch Forum
Topic: AUTO CONTROL+F
Replies: 2
Views: 1428

Re: AUTO CONTROL+F

Mmm... Is that because you have not searched for the appropriate terms perhaps?

If you want to open an application (not a file) and after that enter/input/send a key (not open the control-f), then perhaps this answer could help you...

Antonio
by Aacini
23 Feb 2023 09:01
Forum: DOS Batch Forum
Topic: if else [solved]
Replies: 2
Views: 1551

Re: if else

Use this way:

Code: Select all

C:\Temp> ( if not exist test.txt ( echo "not there" ) else echo "it's there" ) & echo "let's do the next things"
Antonio
by Aacini
30 Jan 2023 14:58
Forum: DOS Batch Forum
Topic: Help with if / loop and variables
Replies: 9
Views: 26098

Re: Help with if / loop and variables

Ok. Let's revisit what I understand from your question: - You have a .txt file. I don't matters where and how you have such a file (if it was downloaded from the web or if it is in a hidden folder, etc.) because such details have not any influence on the solution. - The example data file is this: 12...
by Aacini
21 Jan 2023 01:20
Forum: DOS Batch Forum
Topic: Can't CLS during redirection - New bug or known?
Replies: 2
Views: 7671

Re: Can't CLS during redirection - New bug or known?

When a CLS command is redirected to a disk file, it output an ASCII 12 character, Ctrl-L called Form Feed that in most printers cause to eject current page and jump to a new page. This is a rather logical "conversion" of screen CLS command to a (paper) text file. This conversion is well-known, but I...
by Aacini
10 Jan 2023 19:01
Forum: DOS Batch Forum
Topic: Converting from bytes to gigabytes in multiple division statements.
Replies: 3
Views: 9048

Re: Converting from bytes to gigabytes in multiple division statements.

Note: 30417637376 Bytes = 28.3286 Gigabytes Let's say I want to convert 30417637376 of bytes to gigabytes. set /A "gb=30417637376/1024" The usual issue is that Command Prompt will refuse to do the division with such large number. C:\Users\Windows10>set /A "gb=30433865728/1024" Invalid number. Numbe...
by Aacini
04 Jan 2023 18:42
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 1994866

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Hi, I've created a windows batch script to solve the issue below, however, it takes around 10 minutes for around 20k lines. This is too long. . . . . . Thanks in advance Too long indeed... Are you using a lot of goto commands? File append >> instead of file redirection > ? Give the following Batch ...
by Aacini
04 Jan 2023 13:23
Forum: DOS Batch Forum
Topic: HTA GUI build
Replies: 5
Views: 23294

Re: HTA GUI build

Perhaps this thread could help you...

Antonio
by Aacini
03 Jan 2023 22:20
Forum: DOS Batch Forum
Topic: Help with if / loop and variables
Replies: 9
Views: 26098

Re: Help with if / loop and variables

If you can't explain with words what you want, then show it with data ... For example, put: "Giving this data file" and post an example file, "And this user input" and show us the user input, "I want this as output", accordingly... If the process is somewhat complex, show us several input and desire...
by Aacini
03 Jan 2023 22:07
Forum: DOS Batch Forum
Topic: how to add decimal numbers using batch file?
Replies: 11
Views: 39591

Re: how to add decimal numbers using batch file?

I copied the above code and adjusted it for your formula, that I think it is: result = 200 * 0.0349 + 0.49 . Here it is: @echo off setlocal EnableDelayedExpansion call :IntAsFP one=1.0000 call :IntAsFP number=200.0000 call :IntAsFP percent=0.0349 call :IntAsFP another=0.4900 set /A result=number*per...
by Aacini
18 Dec 2022 19:47
Forum: DOS Batch Forum
Topic: simple Batch based Tail
Replies: 6
Views: 9536

Re: simple Batch based Tail

. . . experimenting showed, that the lockfile removing statement wasnt called by the interpreter when written within single quotes behind the redirection operator. start cmd -c 'cd directory & nmake xyt -f makefile ^>log & del lock' it was necesary to call it after nmake finishes, so that the contr...
by Aacini
16 Dec 2022 23:53
Forum: DOS Batch Forum
Topic: simple Batch based Tail
Replies: 6
Views: 9536

Re: simple Batch based Tail

Mmmm... Ok, these are my thoughts At the very first place, your Batch file is not a Tail one! It always show all file lines . I think your Batch file would lost lines if the file is small and the forked process output lines very fast. Also, your Batch file lost any "duplicated line", that is, any li...
by Aacini
06 Dec 2022 14:11
Forum: DOS Batch Forum
Topic: Maze game questions
Replies: 3
Views: 7878

Re: Maze game questions

I invite you to review my Tetris game (the color version is here) and my VIBORAS.bat game (a multi-player version of Snake game).

Both programs makes an extensive use of "collision detection".

I hope it helps...

Antonio
by Aacini
28 Nov 2022 18:01
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 112758

Re: infinite loop with break condition

Your idea is interesting! Use FilePointer.exe to move the file pointer of cmd.exe in order to perform a fast goto! However, you missed a very important point from FilePointer.exe documentation: Get or set the file pointer position OF A REDIRECTED FILE HANDLE. FilePointer HANDLE [position [/C|/E]] Th...
by Aacini
27 Nov 2022 03:47
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 112758

Re: infinite loop with break condition

I just read the posts from 2022/Oct/22 onwards. IMHO you have lost the point of this thread... Of course, there are several factors that influence the speed of a Batch file that have loops. However, I think that the purpose of this thread was to speed up a loop that was assembled via a goto command ...