Search found 4314 matches

by Squashman
03 Nov 2023 05:18
Forum: DOS Batch Forum
Topic: Foxidrive has left us
Replies: 42
Views: 181279

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

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

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

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...
by Squashman
03 May 2023 19:04
Forum: DOS Batch Forum
Topic: Notepad bug
Replies: 10
Views: 9527

Re: Notepad bug

Momentarily i can't check whether or not notepad offers selecting a specific encoding for other versions of windows. Wow. I never even knew that was an option in Notepad. I have always just opened up a text file by using my mouse. Interesting to know that it is just guessing the wrong encoding. I w...
by Squashman
02 May 2023 15:39
Forum: DOS Batch Forum
Topic: Notepad bug
Replies: 10
Views: 9527

Notepad bug

Hi Everyone. Long time no see. Got a new job working in the Unix world so kind of gave up on the batch file stuff. But........today my old job called me because of an issue with a text file they were viewing in notepad. The file was nothing but a single line. A trailer record in this case as the fil...
by Squashman
23 Feb 2022 18:31
Forum: DOS Batch Forum
Topic: How to remove a path from all lines in file? Filenames should be kept.
Replies: 1
Views: 4103

Re: How to remove a path from all lines in file? Filenames should be kept.

I just went back and looked at a lot of your threads. I see no reason why you shouldn't know how to do this already with all of the code you have been given the past 10 years. Many of your threads show the usage of the `FOR` command modifiers that allows you to split apart the path and file name and...
by Squashman
21 Feb 2022 22:36
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28396

Re: Wmic.exe

This is awesome! Thanks Antonio!
by Squashman
18 Feb 2022 17:06
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28396

Re: Wmic.exe

I don't expect that MS is going to remove WMIC from the CLI tools in the near future. Did you find any information that makes you believe they are about to do so, Squashman? However, PS is an alternative as well as JS. And if I have to calculate with datetime values, I already tend to use them rath...
by Squashman
16 Feb 2022 02:04
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28396

Wmic.exe

What is everyone's plan for when Microsoft pulls the plug on wmic.exe? it has always been our stop gap for getting the date and time in a consistent format. I guess I dont mind calling out to Powershell. Penny for your thoughts.
by Squashman
15 Feb 2022 00:02
Forum: DOS Batch Forum
Topic: Condense Day-Date-Time Code for Reports.
Replies: 12
Views: 10318

Re: Condense Day-Date-Time Code for Reports.

PAB wrote:
14 Feb 2022 21:03
It also works for the SECOND Script, I just needed to use !Created! instead of %Created%.
You would not need to use delayed expansion for the variable and all the other variables if you just got rid of the UNNECESARY parentheses.
by Squashman
14 Feb 2022 11:36
Forum: DOS Batch Forum
Topic: Batch file to merge two column strings from two files into one file
Replies: 4
Views: 5346

Re: Batch file to merge two column strings from two files into one file

Code: Select all

@echo off
setlocal enabledelayedexpansion
< file2.txt ( FOR /F "delims=" %%G IN (file1.txt) DO (
set /p file2=
echo %%G !file2!
)
)>combined.txt
by Squashman
10 Feb 2022 23:03
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 7071

Re: Check which of many network domains the current machine is in then run a script

Batch files execute each line in the script from top to bottom. Regardless of the goto, once the for command is done executing it is going to execute the next command in the script.