Search found 4316 matches
- 04 Jan 2024 15:15
- Forum: DOS Batch Forum
- Topic: Batch File To Change Date Format In Filename
- Replies: 7
- Views: 8199
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 ...
- 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: 17619
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.
- 22 Dec 2023 17:00
- Forum: DOS Batch Forum
- Topic: identify all instance id's in output of pnputil and then sends remove-device command for each
- Replies: 1
- Views: 5591
Re: identify all instance id's in output of pnputil and then sends remove-device command for each
1)Pipe the output to the FINDSTR command to isolate the Instance ID.
2) Capture that command output with a FOR /F command like you have done in other batch files.
3) Run the command to remove the device with that output.
Make an attempt.
2) Capture that command output with a FOR /F command like you have done in other batch files.
3) Run the command to remove the device with that output.
Make an attempt.
- 20 Dec 2023 10:53
- Forum: DOS Batch Forum
- Topic: Batch file to replace - with . in file name
- Replies: 6
- Views: 17663
Re: Batch file to replace - with . in file name
@echo off cd /d "%~dp0" for /f "delims=" %%i in ('dir /b /s /a-d *-*.pdf') do ( set "OldFile=%%i" set "OldName=%%~nxi" setlocal enabledelayedexpansion set NewName=!OldName:- Deposit=TALLY! set NewName=!NewName:-=.! ren "!OldFile!" "!NewName!" endlocal ) pause You should just change your name to Bat...
- 19 Dec 2023 22:17
- Forum: DOS Batch Forum
- Topic: Replace Word In Filename With Another Word
- Replies: 3
- Views: 5714
Re: Replace Word In Filename With Another Word
Again this is basic string substitution. Your last two forum threads covered both of what you want to do. What don't you understand?
- 18 Dec 2023 18:46
- Forum: DOS Batch Forum
- Topic: if statement or if satement
- Replies: 4
- Views: 6551
Re: if statement or if satement
When you read the help file for the IF command where did it show usage for using a PIPE or OR?
- 17 Dec 2023 19:06
- Forum: DOS Batch Forum
- Topic: Batch file to delete .inf files from a ADMIN CMDprompt.
- Replies: 7
- Views: 10972
Re: Batch file to delete .inf files from a ADMIN CMDprompt.
Your code is just echoing to the screen what the pnputil execution would do.
- 16 Dec 2023 21:57
- Forum: DOS Batch Forum
- Topic: How to make an underscore variable "-----" with the length of the argument variable?
- Replies: 5
- Views: 8386
Re: How to make an underscore variable "-----" with the length of the argument variable?
“If you give a man a fish, you feed him for a day. If you teach a man to fish, you feed him for a lifetime.”
- 15 Dec 2023 12:13
- Forum: DOS Batch Forum
- Topic: How to make an underscore variable "-----" with the length of the argument variable?
- Replies: 5
- Views: 8386
Re: How to make an underscore variable "-----" with the length of the argument variable?
Start by using the String Length function from the Dostips Library. https://www.dostips.com/DtTipsStringOperations.php#Function.strLen Then you have a few options from there. You could use a for /l loop to build the underscore variable to the correct length. You could also have a predefined undersco...
- 05 Dec 2023 12:49
- Forum: DOS Batch Forum
- Topic: Copy cmd window and write to .txt
- Replies: 2
- Views: 18321
Re: Copy cmd window and write to .txt
You were told 7 years ago by the now deceased Foxidrive on alt.msdos.batch.nt that those programs output as unicode. And Foxidrive showed you how to use the TYPE command to translate them back to ASCII.
- 05 Dec 2023 12:38
- Forum: DOS Batch Forum
- Topic: dism.exe isn't running.
- Replies: 6
- Views: 23671
Re: dism.exe isn't running.
And you have been warned about not using quotes with IF comparisons at least twice previously.
viewtopic.php?f=3&t=10778&p=68385#p68387
viewtopic.php?f=3&t=9397&p=60988#p60991
viewtopic.php?f=3&t=10778&p=68385#p68387
viewtopic.php?f=3&t=9397&p=60988#p60991
- 05 Dec 2023 12:26
- Forum: DOS Batch Forum
- Topic: dism.exe isn't running.
- Replies: 6
- Views: 23671
Re: dism.exe isn't running.
Thank you both for the reply... That solved that problem. I have run into another problem that I can't figure out. C:\>C:\Batch\SetACL.exe -on "C:\Temp" -ot folder -actn ace "n:Win10BootRepair\Gary;p:full" ERROR in command line: Invalid object type specified: folder! Like when you posted this same ...
- 05 Dec 2023 12:11
- Forum: DOS Batch Forum
- Topic: My syntax is not correct
- Replies: 3
- Views: 13884
Re: My syntax is not correct
Thank you very much. That's great to know. It's very nice of you to share your knowledge. Straight from the help file for the findstr command. Use spaces to separate multiple search strings unless the argument is prefixed with /C. I have seen a pattern with some of your questions and it seems like ...
- 05 Dec 2023 11:59
- Forum: DOS Batch Forum
- Topic: Batch file to replace - with . in file name
- Replies: 6
- Views: 17663
Re: Batch file to replace - with . in file name
Anyone know how to make a batch file to replace all dashes (-) in a file name with periods (.)? I basically have a ton of PDF files that are named like this: HN TALLY 11-18-23.pdf HN TALLY 11-19-23.pdf REG 11-20-23.pdf EW CAR 11-21-23.pdf and so on.... I would like it to rename the files like this ...
- 22 Nov 2023 20:39
- Forum: DOS Batch Forum
- Topic: Change to upper case and add a :
- Replies: 4
- Views: 19037
Re: Change to upper case and add a :
I would like to make sure the input letter is upper case and I would like to add a : the code below doesn't add the colin. setlocal EnableDelayedExpansion set /p Drive=Please enter drive letter. Example C call :Uppercase Drive set "colin = :" set "Drive &= %colin%" Echo %Drive% cmd /k You cannot be...