Search found 167 matches

by atfon
26 May 2022 06:14
Forum: DOS Batch Forum
Topic: How to determine privileges?
Replies: 3
Views: 51

Re: How to determine privileges?

Depending on the level of privileges you want to determine, could you search by the Security Identifier? For example, the INFO.BAT script on this site https://www.dostips.com/forum/viewtopic.php?f=3&t=6108&p=49091#p49091 uses the following to check for Admin privileges: whoami /groups |findstr /i "\...
by atfon
29 Apr 2022 08:39
Forum: DOS Batch Forum
Topic: Scripts to get hour not always correct
Replies: 4
Views: 1247

Re: Scripts to get hour not always correct

Have a look at this post from aGerman where he explains how to set a clock to AM/PM: viewtopic.php?f=3&t=2051#p64840
by atfon
28 Apr 2022 06:15
Forum: DOS Batch Forum
Topic: How to define screen buffer size for "Mode 120,60" command?
Replies: 8
Views: 648

Re: How to define screen buffer size for "Mode 120,60" command?

If you are open to powershell, I've done this from a batch script:

Code: Select all

powershell.exe -noprofile -command "&{$w=(get-host).ui.rawui;$w.buffersize=@{width=120;height=9001};$w.windowsize=@{width=120;height=60};}"
by atfon
08 Apr 2022 20:32
Forum: DOS Batch Forum
Topic: First Post: Set file name full date subtract 1 day
Replies: 7
Views: 1180

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

What happen if current day is the 1st one? One day before would be the last day of previous month... If the current day is January/1st, then one day before would be December/31 of previous year... If current day is March/1st the day before would be February/28, excepting if the year is a leap year....
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: 1180

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

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

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

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

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

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

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

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

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

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

Re: Wmic.exe

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

https://wutils.com/wmi/