Search found 4314 matches

by Squashman
25 Feb 2024 14:37
Forum: DOS Batch Forum
Topic: Automating the generation of macros usable within other macros
Replies: 4
Views: 2702

Re: Automating the generation of macros usable within other macros

Maybe we could ask Peter to put some of this on the main web page of the site. Or maybe we start a git repo.
by Squashman
22 Feb 2024 13:51
Forum: DOS Batch Forum
Topic: How to get the next reboot time of Windows 10
Replies: 1
Views: 2193

Re: How to get the next reboot time of Windows 10

How would we know what program or scheduler is doing a programmatic reboot?
by Squashman
18 Feb 2024 09:00
Forum: DOS Batch Forum
Topic: Move flashing prompt sign away from left edge of PowerShell window
Replies: 7
Views: 22402

Re: Move flashing prompt sign away from left edge of PowerShell window

Seems to work just fine for me. Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\Squashman> function prompt {Write-Host (" " * 10) -NoNewline} PS>function prompt {Write-Host (" " * 15) -NoNewline} P>...
by Squashman
02 Feb 2024 11:11
Forum: DOS Batch Forum
Topic: Extract missing record
Replies: 6
Views: 4626

Re: Extract missing record

Thank you Antonio, it works fine, but the problem is a pdf directory is a windows share slow and takes long time to read 1 milion of pdf, so I prefer before do a dir /b > file.txt and work on a file.txt As I said in my previous post, a base FOR command should be faster than reading a million line f...
by Squashman
01 Feb 2024 17:13
Forum: DOS Batch Forum
Topic: Extract missing record
Replies: 6
Views: 4626

Re: Extract missing record

yes you are right, the problem is that with millions of records it takes too long, so I decided to do a dir of the directory first. I'll try to work on it and post the solution, see if I can solve the problem With that big of a file you are going to see slow processing with the FOR /F command readi...
by Squashman
01 Feb 2024 13:12
Forum: DOS Batch Forum
Topic: Extract missing record
Replies: 6
Views: 4626

Re: Extract missing record

I really think you could attempt this one on your own. Just one solution would be to do the following. 1) FOR /F command to read the text file. 2) FOR /F command to split apart the base file name into multiple FOR variable tokens. 3) IF TOKEN 4 is not blank test if tokens 1_2_3.pdf is in the file. I...
by Squashman
31 Jan 2024 14:44
Forum: DOS Batch Forum
Topic: Execute a ffmpeg command for each mp3 file in a folder
Replies: 7
Views: 4824

Re: Execute a ffmpeg command for each mp3 file in a folder

I would think your code page would be set properly considering you are in the EU. Would be interesting to see what your code page is currently set to. You can type chcp at a command prompt to get that information. You can change the code page with the chcp command as well. You could try 65001.
by Squashman
31 Jan 2024 13:46
Forum: DOS Batch Forum
Topic: Batch File To Create Folder With Current Date
Replies: 14
Views: 34555

Re: Batch File To Create Folder With Current Date

test-2.bat @echo off set "YourLocation=C:\Test" for /f %%i in ('powershell "Get-Date -uformat '%%Y%%m%%d'"') do ( set "Today=%%i" ) set "Today=%Today:~4,2%-%Today:~6,2%-%Today:~0,4%" echo,%Today% md "%YourLocation%\%Today%" pause Ok never mind. I got it to work but I was wondering, how do I change ...
by Squashman
31 Jan 2024 13:27
Forum: DOS Batch Forum
Topic: Batch File To Create Folder With Current Date
Replies: 14
Views: 34555

Re: Batch File To Create Folder With Current Date

I get this feeling that it could be that our network drives are setup in a specific way so that the user that creates the folders may have certain permissions set to so they can edit or delete files within them and because, technically, your code is creating the folder instead of a user, that may b...
by Squashman
15 Jan 2024 10:17
Forum: DOS Batch Forum
Topic: FOR /R puzzler? (wildcarded folders only, e.g. A*)
Replies: 5
Views: 5361

Re: FOR /R puzzler? (wildcarded folders only, e.g. A*)

If you want the specific directories only then code for that using the DIR command.

Code: Select all

FOR /F "delims=" %%G IN ('dir A* /AD /B') DO findstr /IC:"cat" "%%G\hat.txt"
by Squashman
08 Jan 2024 09:49
Forum: DOS Batch Forum
Topic: code in else statement not executing
Replies: 4
Views: 5770

Re: code in else statement not executing

Good to see I needed to change %errorlevel% to !errorlevel! towards the end. You wouldn't need to use delayed expansion for the errorlevel if you would just adopt the builtin errorlevel usage of the IF command. IF errorlevel 1 ( echo reader ID not found. ) else ( echo reader id found )
by Squashman
05 Jan 2024 15:37
Forum: DOS Batch Forum
Topic: Faster batch macros
Replies: 17
Views: 11141

Re: Faster batch macros

Awesome. How I miss the batch file creativity. Been working as Unix admin the last year.
I can't remember if we had a running thread of all the Macros that have been created so far.
by Squashman
05 Jan 2024 10:25
Forum: DOS Batch Forum
Topic: Batch File To Change Date Format In Filename
Replies: 7
Views: 7963

Re: Batch File To Change Date Format In Filename

It is simpler to just indicate findstr to match files that start in a space , followed by ##.##.##.pdf, so it just match " MM.DD.YY.pdf" and not " YYYY.MM.DD": dir /b /a-d *.pdf ^| findstr /i /e /R /C:" [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.pdf" Antonio I didn't want to assume all the files had a spa...
by Squashman
04 Jan 2024 15:15
Forum: DOS Batch Forum
Topic: Batch File To Change Date Format In Filename
Replies: 7
Views: 7963

Re: Batch File To Change Date Format In Filename

Thank you very much. It's working great except I had some dates that were already formatted correctly and those got messed up. Is there a way you could add a feature that if the date is already in YYYY.MM.DD format, just leave it alone? If not, no worries. I will just make a note in the code to be ...
by Squashman
28 Dec 2023 09:40
Forum: DOS Batch Forum
Topic: Deleting from a Recycle Bin folder all items except certain file formats
Replies: 13
Views: 17212

Re: Deleting from a Recycle Bin folder all files except certain file formats

And so the Recycle Bin is the last resort in efforts of retrieving potentially hours of work that was performed even as far as months ago. Wow. If I only had known all these decades that I could just use the recycle bin as a backup mechanism. This should literally bankrupt that software sector.