Search found 573 matches

by Compo
26 Mar 2022 14:48
Forum: DOS Batch Forum
Topic: How to get the number after fail in a string inside a file
Replies: 8
Views: 1744

Re: How to get the number after fail in a string inside a file

You could optionally modify the command to get the first pass number too: @Echo Off & SetLocal EnableExtensions DisableDelayedExpansion Set "passNumber=" & For /F "Delims=" %%G In ('%SystemRoot%\System32\findstr.exe /IR /C:"window\.output\[\"stats\"\] = \[\[{.*\"[fp]a[is][ls]\":[0123456789][01234567...
by Compo
24 Mar 2022 14:10
Forum: DOS Batch Forum
Topic: How to get the number after fail in a string inside a file
Replies: 8
Views: 1744

Re: How to get the number after fail in a string inside a file

Or selecting only a line matching that which you've posted, and regardless of the postition or the number of digits… @Echo Off & SetLocal EnableExtensions DisableDelayedExpansion Set "failNumber=" & For /F "Delims=" %%G In ('%SystemRoot%\System32\findstr.exe /IRC:"window\.output\[\"stats\"\] = \[\[{...
by Compo
20 Mar 2022 17:25
Forum: DOS Batch Forum
Topic: Scripts to get hour not always correct
Replies: 4
Views: 1248

Re: Scripts to get hour not always correct

The first thing you need to understand is that %TIME% is locale, PC, and user configurable and may not therefore return a string in the format you require for splitting, and even if it is, that may not be returned as a 24 hour clock string. There are many ways of retrieving the time in a consistent ...
by Compo
04 Mar 2022 11:31
Forum: DOS Batch Forum
Topic: Doing MOD calculations in batch
Replies: 8
Views: 31478

Re: Doing MOD calculations in batch

<SNIP /> set /a "divnd2=%divnd%" <SNIP /> set /a "qtnt=%divnd%/divsr%" set /a "mod=%divnd%%%divsr%" <SNIP /> You should be using this instead: set /a divnd2 = divnd set /a qtnt = divnd / divsr set /a mod = divnd %% divsr Or if you want to minimize characters, but still use doublequotes: set /a "div...
by Compo
23 Feb 2022 14:50
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 5350

Re: Wmic.exe

Too much to <QUOTE />/<SNIP /> out, so just to say that I'm glad my information/prompt has assisted you in improving your alternative solution Antonio.
by Compo
23 Feb 2022 05:53
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 5350

Re: Wmic.exe

I doubt I have to tell most of you on this forurm, but for those who might not be aware, you can get a list of WMI aliases Friendly Name and Corresponding full name with this command: wmic alias list brief Whilst that may be useful to some, it doesn't really provide all of the information needed to...
by Compo
19 Feb 2022 06:47
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 5350

Re: Wmic.exe

I for one, should I ever decide to purchase a Windows 11 capable unit, will bite the bullet, and begin to phase out my over use of batch files, in favour of PowerShell scripts. For batch files which used WMIC.exe, which was already one of the slowest things to invoke, (especially on its first run) ,...
by Compo
19 Feb 2022 06:18
Forum: DOS Batch Forum
Topic: CMD.exe to Windows Terminal Porting: command line commands
Replies: 3
Views: 1619

Re: CMD.exe to Windows Terminal Porting: command line commands

In Windows 10 and Windows 7, I used to have many batch files that would launch cmd.exe and issue commands using the /c option. Like this: cmd.exe /c mkdir "c:\Users\mike\Desktop\newfold" & start "" "c:\Users\mike\Desktop\newfold" TBH, you should ideally look into the reason why you're doing that at...
by Compo
08 Feb 2022 19:30
Forum: DOS Batch Forum
Topic: Change desktop wallpaper
Replies: 17
Views: 4780

Re: Change desktop wallpaper

I'm not sure how your question is relevant to the issue at hand. Have you attempted to install, and use the x86 version for the task, but it has failed to work?
by Compo
08 Feb 2022 19:24
Forum: DOS Batch Forum
Topic: Find data in an external database with Batch
Replies: 3
Views: 1531

Re: Find data in an external database with Batch

I'm sure it is possible, however, i'd advise that you do not, especially when you are not experienced with batch files. I'd advise that you do not use your multiple secret, WMIC commands in cmd, to output in UTF-16 LE many pieces of data, then try to validate one or more using its poor implementatio...
by Compo
08 Feb 2022 04:43
Forum: DOS Batch Forum
Topic: Batch file to delete specific files on multiple folders
Replies: 2
Views: 1336

Re: Batch file to delete specific files on multiple folders

As an alternative to the solution you've been provided with already, over on StackOverflow, maybe the following would work for you.

Code: Select all

@For /F "UseBackQ Delims=" %%G In ("DeleteList.txt") Do @For /D %%H In ("C:\folder\DMP\app_x*") Do @Del /A /F "%%~H\%%~nxG"
by Compo
13 Jan 2022 12:59
Forum: DOS Batch Forum
Topic: Use Checklist to Run Selected Commands.
Replies: 7
Views: 1664

Re: Use Checklist to Run Selected Commands.

Apologies, my example was really to show you the choice use per command, however, to use it as you appear to be doing, you should not use GoTo, but use Call instead: Example: @Echo Off %SystemRoot%\System32\choice.exe /M "Would you like to open Paint" If Not ErrorLevel 2 Call :Command1 %SystemRoot%\...
by Compo
12 Jan 2022 18:53
Forum: DOS Batch Forum
Topic: Use Checklist to Run Selected Commands.
Replies: 7
Views: 1664

Re: Use Checklist to Run Selected Commands.

Why not just simplify the process? %SystemRoot%\System32\choice.exe /M "Would you like to run Command1" If Not ErrorLevel 2 Command1 %SystemRoot%\System32\choice.exe /M "Would you like to run Command2" If Not ErrorLevel 2 Command2 %SystemRoot%\System32\choice.exe /M "Would you like to run Command3" ...
by Compo
12 Jan 2022 18:45
Forum: DOS Batch Forum
Topic: how do i make an output of ECHO SET V5=2>> %BAT%
Replies: 16
Views: 3096

Re: how do i make an output of ECHO SET V5=2>> %BAT%

If you had shown the common decency to have acknowledged my code earlier than the twelve days, since I offered it to you, I'd have happily explained to you how to get it to work properly with your modified commands. I gave you ample opportunity to do so, and prompted you about that too, but you deci...
by Compo
12 Jan 2022 03:06
Forum: DOS Batch Forum
Topic: getting current, parent directory name with a special & letter
Replies: 13
Views: 2652

Re: getting current, parent directory name with a special & letter

Well, I tried…

Code: Select all

@WMIC Path Dos_Tips Where "AccountName='nnnmmm'" Get OutaHere 1>NUL 2>&1