Search found 178 matches

by atfon
08 Apr 2022 14:03
Forum: DOS Batch Forum
Topic: First Post: Set file name full date subtract 1 day
Replies: 7
Views: 6625

Re: First Post: Set file name full date subtract 1 day

@echo off setlocal enabledelayedexpansion for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh ^| find ":"') do ( set "_year=%%a" & set "_month=%%b" & set "_day=%%c" set /a "_day=1!_day!-100" set /a "_day=!_day! - 1" if !_day! LSS 10 set "_day=0!_day!" set "_date=!_year!-!_month!-!_day!" ) e...
by atfon
08 Apr 2022 10:22
Forum: DOS Batch Forum
Topic: xcopy not working
Replies: 2
Views: 4189

Re: xcopy not working

Type the same xcopy command into the command line to see it would fail there too. It is going to ask you to specify if the item is a file or directory. While language dependent, one option is to add "echo F|" in front of your xcopy command: https://ss64.com/nt/xcopy.html For a single file, you are b...
by atfon
08 Apr 2022 09:23
Forum: DOS Batch Forum
Topic: First Post: Set file name full date subtract 1 day
Replies: 7
Views: 6625

Re: First Post: Set file name full date subtract 1 day

It sounds like you are running into an issue where the script is generating a leading 0 that is specifying an Octal. See the section "Leading Zero will specify Octal" here: https://ss64.com/nt/set.html There are certainly workarounds: https://www.dostips.com/forum/viewtopic.php?t=4911#p28550 To dete...
by atfon
06 Apr 2022 09:28
Forum: DOS Batch Forum
Topic: Searching a string within a text file
Replies: 5
Views: 5209

Re: Searching a string within a text file

You are just trying to find out if text is present in the file? Why not something as simple as: type "%programfiles(x86)%\sendEmail\sendemail.log" |findstr /c:"Email was sent successfully!" >nul 2>&1 if %errorlevel% EQU 0 ( echo do something if found ) else ( echo do something if not found ) Replace...
by atfon
04 Apr 2022 11:42
Forum: DOS Batch Forum
Topic: Creating a script to gather PC information - to assist those asking for help
Replies: 167
Views: 151207

Re: Creating a script to gather PC information - to assist those asking for help

aGerman wrote:
04 Apr 2022 10:49
A removal of WMIC won't affect the functionality of the script. So, there's no reason for an update...

Steffen
Aren't you using WMIC to determine the code page and assign that to the %ACP% variable? Aren't you then using that variable to determine things like the directory format?
by atfon
04 Apr 2022 06:51
Forum: DOS Batch Forum
Topic: Creating a script to gather PC information - to assist those asking for help
Replies: 167
Views: 151207

Re: Creating a script to gather PC information - to assist those asking for help

I know this script takes into account whether WMIC is installed. However, are there plans to adjust it to account for the eventual removal of WMIC in Windows 11?
by atfon
30 Mar 2022 12:10
Forum: DOS Batch Forum
Topic: How to run Internet Explorer in Windows 11
Replies: 1
Views: 4065

Re: How to run Internet Explorer in Windows 11

Thank you for the script, Jean-Francois. It is also interesting to see that the MSHTML (Trident) engine for IE 11 will continue to be supported:

https://techcommunity.microsoft.com/t5/ ... -p/2366549
by atfon
07 Mar 2022 08:36
Forum: DOS Batch Forum
Topic: progress bar while copying (xcopy)
Replies: 4
Views: 9320

Re: progress bar while copying (xcopy)

Is there any reason you just want to use xcopy for this? Robocopy has been a standard part of Windows since Vista and has a built in progress feature:

https://ss64.com/nt/robocopy.html
by atfon
02 Mar 2022 14:22
Forum: DOS Batch Forum
Topic: Capture registry value of variable number of words
Replies: 2
Views: 3322

Re: Capture registry value of variable number of words

aGerman wrote:
02 Mar 2022 14:05
You want to get the rest (token *) after token 2, right? So, what about

Code: Select all

for /f "tokens=2*" %%a in ('...') do set "var=%%b"
Steffen
Well, that was a silly mistake. I was thinking I had to grab the third token and later. That's exactly what I needed. Thanks again, Steffen.
by atfon
02 Mar 2022 12:26
Forum: DOS Batch Forum
Topic: Capture registry value of variable number of words
Replies: 2
Views: 3322

Capture registry value of variable number of words

I would like to know how to capture a value from the registry as a variable when that value may be multiple words or not. Here is a quick example that would work if the value was one word: for /f "tokens=3*" %%a in ('%__APPDIR__%reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "R...
by atfon
23 Feb 2022 15:11
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28680

Re: Wmic.exe

FWIW, I find this site to be helpful for just browsing the available WMI namespaces, classes, etc.

https://wutils.com/wmi/
by atfon
23 Feb 2022 14:45
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28680

Re: Wmic.exe

Very nice! Thank you, Antonio.
by atfon
22 Feb 2022 13:05
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28680

Re: Wmic.exe

I doubt I have to tell most of you on this forurm, but for those who might not be aware, you can get a list of WMI aliases Friendly Name and Corresponding full name with this command:

Code: Select all

wmic alias list brief
by atfon
16 Feb 2022 08:55
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28680

Re: Wmic.exe

Like Bitsadmin, wmic has been "deprecated" for years now. I highly doubt it's going anywhere; if nothing else, Microsoft prioritizes backwards compatibility. That's the reason Windows 11 still even has batch even though they've been trying to push PowerShell ever since it was created. That falls in...
by atfon
16 Feb 2022 07:10
Forum: DOS Batch Forum
Topic: Wmic.exe
Replies: 26
Views: 28680

Re: 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. As far as the Date/Time, I guess Robocopy is still an option in this l...