Search found 590 matches

by Compo
16 Jan 2023 20:25
Forum: DOS Batch Forum
Topic: Issues with my progress bar
Replies: 3
Views: 8424

Re: Issues with my progress bar

It's not going to be easy to help you when you only post some of your code! In addition to that, the code you have posted is invalid, because it has more closing parentheses than it does opening ones. This may suggest that what you have posted is already nested or subnested within other code blocks ...
by Compo
08 Jul 2022 04:53
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 34265

Re: How to put inner quotes in outer quotes in "for" loop?

<SNIP /> FOR /F "tokens=*" %%a IN ('^""\\mydomain.local\netlogon\system_files\10.0\dsquery.exe" * OU=MyOU,dc=mydomain,dc=local-l -attr emQualifications title mobile emPosition telephoneNumber mail emBanner emPosition emUniPosition emPrenameTitle -filter "cn=%FULLNAME%"^"') DO ( SET /a X+=1 SET USER...
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: 7527

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

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

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

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

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

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

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

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

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

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

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

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

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" ...