Search found 4315 matches

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

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.
by Squashman
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: 5555

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.
by Squashman
20 Dec 2023 10:53
Forum: DOS Batch Forum
Topic: Batch file to replace - with . in file name
Replies: 6
Views: 17605

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...
by Squashman
19 Dec 2023 22:17
Forum: DOS Batch Forum
Topic: Replace Word In Filename With Another Word
Replies: 3
Views: 5669

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?
by Squashman
18 Dec 2023 18:46
Forum: DOS Batch Forum
Topic: if statement or if satement
Replies: 4
Views: 6481

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?
by Squashman
17 Dec 2023 19:06
Forum: DOS Batch Forum
Topic: Batch file to delete .inf files from a ADMIN CMDprompt.
Replies: 7
Views: 10932

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.
by Squashman
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: 8360

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.”
by Squashman
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: 8360

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...
by Squashman
05 Dec 2023 12:49
Forum: DOS Batch Forum
Topic: Copy cmd window and write to .txt
Replies: 2
Views: 18300

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.
by Squashman
05 Dec 2023 12:38
Forum: DOS Batch Forum
Topic: dism.exe isn't running.
Replies: 6
Views: 23630

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
by Squashman
05 Dec 2023 12:26
Forum: DOS Batch Forum
Topic: dism.exe isn't running.
Replies: 6
Views: 23630

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 ...
by Squashman
05 Dec 2023 12:11
Forum: DOS Batch Forum
Topic: My syntax is not correct
Replies: 3
Views: 13860

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 ...
by Squashman
05 Dec 2023 11:59
Forum: DOS Batch Forum
Topic: Batch file to replace - with . in file name
Replies: 6
Views: 17605

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 ...
by Squashman
22 Nov 2023 20:39
Forum: DOS Batch Forum
Topic: Change to upper case and add a :
Replies: 4
Views: 19007

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...
by Squashman
16 Nov 2023 11:38
Forum: DOS Batch Forum
Topic: [Solved] Need help to convert single line xml file to sequential line
Replies: 7
Views: 22873

Re: Need help to convert single line xml file to sequential line

This should get you started. https://stackoverflow.com/questions/33077104/batch-script-for-formatting-xml-files-search-for-strings-and-comment-them-out Hey thanks, but this doesn't skip the first 2 tags and I don't want it to be format like this <xml> <tag> <othertag> </othertag> </tag> </xml> Wasn...