Search found 4309 matches

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

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

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

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

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

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

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

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

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

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...
by Squashman
10 Nov 2023 15:59
Forum: DOS Batch Forum
Topic: Problems working a script
Replies: 6
Views: 19621

Re: Problems working a script

Tai wrote:
06 Nov 2023 01:42
It is not a homework assignment, but an optional task to learn more.
Image
by Squashman
03 Nov 2023 05:18
Forum: DOS Batch Forum
Topic: Foxidrive has left us
Replies: 42
Views: 166356

Re: Foxidrive has left us

7 years. Your contributions and comraderie are missed.
by Squashman
31 Jul 2023 22:25
Forum: DOS Batch Forum
Topic: Info about deletion lies when no items were deleted when dealing with sub-folders
Replies: 1
Views: 2425

Re: Info about deletion lies when no items were deleted when dealing with sub-folders

Set a variable inside the loop. The variable will only be defined if the execution of the FOR command has data to parse. Then echo if the variable is defined. @echo off set "ITEMS-IN-THIS-FOLDER-WILL-BE-DELETED=C:\q\Corel Draw - CDR Auto-Backup Files\" set "file_flag=" for /r "%ITEMS-IN-THIS-FOLDER-...
by Squashman
31 Jul 2023 22:05
Forum: DOS Batch Forum
Topic: Batch file works fine. When converted to exe it doesn't
Replies: 1
Views: 2277

Re: Batch file works fine. When converted to exe it doesn't

Search the forum. This topic has been covered ad nauseam. Those threads will discuss the basics. 1) You are not creating an executable. You are creating a self-extracting file. It first extracts all the data to a temporary folder before executing. 2) The exe extracting the batch file to a temporary ...
by Squashman
31 Jul 2023 22:01
Forum: DOS Batch Forum
Topic: escaping powershell in batch loop
Replies: 1
Views: 2421

Re: escaping powershell in batch loop

Remember you are using a batch file. So any special characters need to be escaped. The closing parentheses thinks you are closing the FOR argument so it thinks the hyphen is a command. You need to escape them. for /f "usebackq tokens=1-3 delims=- " %%a in (` powershell.exe -Command "Get-EventLog -Er...