
Steffen
Moderator: DosItHelp
Code: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 10.0.14393]
Product name : Windows 10 Pro, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 4192432 kilobytes
Date/Time format : mm/dd/yy (12 hours) Mon 09/05/2016 23:35:49.16
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 437 ANSI 1252
DIR format : 09/01/2016 01:03 AM 6,174,015,488 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
Missing from the tool collection: debug
dbenham wrote:I've run into a problem on my Win 10 machine at home. I thought the script was supposed to be non-destructive, but when I run the script it changes my console font from "Raster Fonts" size 8x12 to "Courier New" size 12. Ouch![]()
![]()
dbenham wrote:Does the 12 hour indicator pertain to DIR output? If so, then perhaps the info layout should change.
Has anyone else tried Win 10 yet? My guess it is a Win 10 specific issue.aGerman wrote:dbenham wrote:I've run into a problem on my Win 10 machine at home. I thought the script was supposed to be non-destructive, but when I run the script it changes my console font from "Raster Fonts" size 8x12 to "Courier New" size 12. Ouch![]()
![]()
HuReading values does change the font? Hard to believe
I'll try to find somthing in the internet if any of the used commands has this side effect.
I'm pretty sure %TIME% always returns 24 hour time with centiseconds, regardless of locale. I believe the only thing that may change is the character used for the decimal point. DATE /T and %DATE% give the same format, but TIME /T and %TIME% do not.aGerman wrote:dbenham wrote:Does the 12 hour indicator pertain to DIR output? If so, then perhaps the info layout should change.
Good question. You are the first person that I know where the formats of %time% and DIR differ.
Code: Select all
C:\test>date /t
Tue 09/06/2016
C:\test>echo %date%
Tue 09/06/2016
C:\test>time /t
08:04 AM
C:\test>echo %time%
8:04:27.82
Code: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 6.1.7601]
Product name : Windows 7 Enterprise, 32 bit
Performance indicators : Processor Cores: 4 Visible RAM: 3659820 kilobytes
Date/Time format : mm/dd/yy (12 hours) 09/06/2016 9:48:04.50
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 437 ANSI 1252
DIR format : 08/24/2016 06:07 PM 3,747,655,680 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
dbenham wrote:Has anyone else tried Win 10 yet? My guess it is a Win 10 specific issue.
dbenham wrote:I'm pretty sure %TIME% always returns 24 hour time with centiseconds, regardless of locale. I believe the only thing that may change is the character used for the decimal point. DATE /T and %DATE% give the same format, but TIME /T and %TIME% do not.
dbenham wrote:It works great on my work machine where REG has been blocked
dbenham wrote:What does "Admin group=Yes" mean
Code: Select all
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
Code: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 10.0.10586]
Product name : Windows 10 Home, 32 bit
Performance indicators : Processor Cores: 4 Visible RAM: 2023612 kilobytes
Date/Time format : (dd/mm/yy) 08.09.2016 0:06:37,12
ComSpec : C:\WINDOWS\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : de-DE Code Pages: OEM 850 ANSI 1252
DIR format : 04.09.2016 16:45 738.197.504 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
User AutoRun found : AutoRun REG_SZ rem "hello"
Code: Select all
CHCP 1252
Code: Select all
@echo off
if "%~1" equ "__:TestOverride__" (
if not defined pathext set "pathExt=.com;.exe;.bat;.cmd"
goto :TestOverride
)
call :TestOverride
exit /b
:TestOverride
setlocal disableDelayedExpansion
if not defined pathext (
"%__APPDIR__%cmd.exe" /c "%~f0" __:TestOverride__
exit /b
)
:: Define LF to contain a new line (0x0A) character
(set LF=^
%= Do not remove or alter this line =%
)
:: Prepare the list of paths in PATH
set "list=.\;%path:"=""%"
set "list=%list:^=^^%"
set "list=%list:&=^&%"
set "list=%list:|=^|%"
set "list=%list:<=^<%"
set "list=%list:>=^>%"
set "list=%list:;=^;^;%"
set list=%list:""="%
set "list=%list:"=""Q%"
set "list=%list:;;="S"S%"
set "list=%list:^;^;=;%"
set "list=%list:""="%"
setlocal EnableDelayedExpansion
set "list=!list:"Q=!"
for %%N in ("!LF!") do set "list="!list:"S"S=.\"%%~N"!""
setlocal disableDelayedExpansion
for /f %%C in ('copy /z "%~dpf0" nul') do (
for /f %%A in (
'^""%__APPDIR__%help.exe" ^| "%__APPDIR__%findstr.exe" /rc:"^[^ ][^ ]* "^"'
) do for /f "delims=" %%F in ('dir /b "%__APPDIR__%%%A.exe" "%__APPDIR__%%%A.com" 2^>nul') do (
<nul set /p "=.%%C %%C%%F"
set "skip="
setlocal enableDelayedExpansion
for /f "delims=" %%P in ("!list!") do if not defined skip (
if "!!" equ "" endlocal
for %%X in (%pathext%) do if not defined skip (
if exist "%%~fP%%~nF%%X" (
if /i "%%~fF" neq "%%~dpP%%~nF%%X" echo is overridden by "%%~dpP%%~nF%%X"
set "skip=1"
)
)
if /i "%%~dpF" equ "%%~dpP" set "skip=1"
)
)
(echo(%%C )
)
exit /b
Code: Select all
@echo off
if "%~1" equ "__:TestOverride__" (
if not defined pathext set "pathExt=.com;.exe;.bat;.cmd"
goto :TestOverride
)
call :TestOverride
exit /b
:TestOverride
setlocal disableDelayedExpansion
if not defined pathext (
"%__APPDIR__%cmd.exe" /c "%~f0" __:TestOverride__
exit /b
)
:: Define LF to contain a new line (0x0A) character
(set LF=^
%= Do not remove or alter this line =%
)
:: Prepare the list of paths in PATH
set "list=.\;%path:"=""%"
set "list=%list:^=^^%"
set "list=%list:&=^&%"
set "list=%list:|=^|%"
set "list=%list:<=^<%"
set "list=%list:>=^>%"
set "list=%list:;=^;^;%"
set list=%list:""="%
set "list=%list:"=""Q%"
set "list=%list:;;="S"S%"
set "list=%list:^;^;=;%"
set "list=%list:""="%"
setlocal EnableDelayedExpansion
set "list=!list:"Q=!"
for %%N in ("!LF!") do set "list="!list:"S"S=.\"%%~N"!""
setlocal disableDelayedExpansion
for /f %%C in ('copy /z "%~dpf0" nul') do (
for %%F in (
"%__APPDIR__%*.exe"
"%__APPDIR__%*.com"
) do (
<nul set /p "=.%%C %%C%%F"
set "skip="
setlocal enableDelayedExpansion
for /f "delims=" %%P in ("!list!") do if not defined skip (
if "!!" equ "" endlocal
for %%X in (%pathext%) do if not defined skip (
if exist "%%~fP%%~nF%%X" (
if /i "%%~fF" neq "%%~dpP%%~nF%%X" echo is overridden by "%%~dpP%%~nF%%X"
set "skip=1"
)
)
if /i "%%~dpF" equ "%%~dpP" set "skip=1"
)
)
(echo(%%C )
)
exit /b
dbenham wrote:Yea![]()
It works great on my work machine where REG has been blocked![]()
Code: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 6.1.7601]
Product name : Windows 7 Enterprise, 32 bit
Performance indicators : Processor Cores: 4 Visible RAM: 3659820 kilobytes
Date/Time format : mm/dd/yy (12 hours) 09/06/2016 9:48:04.50
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 437 ANSI 1252
DIR format : 08/24/2016 06:07 PM 3,747,655,680 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
What does "Admin group=Yes" meanI am surprised to see that result given that configuration of my machine is completely locked down.
I cannot do any of the following
- install software
- change the date or time
- I'm not sure, but I don't think I can open command prompt as administrator. The Window opens, but the title does not indicate admin mode.
Dave Benham
Code: Select all
if defined whoami 2>nul %whoami% /groups|>nul %findstr% /i "\<S-1-5-32-544\>" && set "LocalAdmin=Yes" || set "LocalAdmin=Yes"
Code: Select all
if defined whoami 2>nul %whoami% /groups|>nul %findstr% /i "\<S-1-5-32-544\>" && set "LocalAdmin=Yes" || set "LocalAdmin=No"
as administratorCode: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Versi¢n 6.2.9200]
Product name : Windows 8 Enterprise, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 8298772 kilobytes
Date/Time format : (dd/mm/yy) 08/09/2016 17:57:42,09
ComSpec : C:\Windows\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : es-ES Code Pages: OEM 850 ANSI 1252
DIR format : 08/09/2016 12:03 8.485.076.992 pagefile.sys
Permissions : Elevated Admin=Yes, Admin group=Yes
Missing from the tool collection: debug
as userCode: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Versi¢n 6.2.9200]
Product name : Windows 8 Enterprise, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 8298772 kilobytes
Date/Time format : (dd/mm/yy) 08/09/2016 17:58:25,06
ComSpec : C:\Windows\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : es-ES Code Pages: OEM 850 ANSI 1252
DIR format : 08/09/2016 12:03 8.485.076.992 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Nope
Missing from the tool collection: debug
as administratorCode: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Versi¢n 6.1.7601]
Product name : Windows Server 2008 R2 Standard, 64 bit
Performance indicators : Processor Cores: 8 Visible RAM: 14677960 kilobytes
Date/Time format : (dd/mm/yy) 08/09/2016 18:08:58,69
ComSpec : C:\Windows\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : es-ES Code Pages: OEM 850 ANSI 1252
DIR format : 05/09/2016 02:02 15.030.231.040 pagefile.sys
Permissions : Elevated Admin=Yes, Admin group=Yes
Missing from the tool collection: debug
as userCode: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Versi¢n 6.1.7601]
Product name : Windows Server 2008 R2 Standard, 64 bit
Performance indicators : Processor Cores: 8 Visible RAM: 14677960 kilobytes
Date/Time format : (dd/mm/yy) 08/09/2016 18:12:45,34
ComSpec : C:\Windows\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : es-ES Code Pages: OEM 850 ANSI 1252
DIR format : 05/09/2016 02:02 15.030.231.040 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Nope
Missing from the tool collection: debug
I know there is a senseless work, but if someone with locale "xx-ES" would like to take care of accents
changeCode: Select all
:: create the information file and send the information to the clipboard if clip is available
>>"%temp%\info.txt" (
for /f "delims=" %%a in ('ver') do echo Windows version : %%a
setlocal EnableDelayedExpansion
echo Product name : !ProductName!, !bit! bit
echo Performance indicators : Processor Cores: !NUMBER_OF_PROCESSORS! Visible RAM: !ram! kilobytes&echo(
to something likeCode: Select all
:: create the information file and send the information to the clipboard if clip is available
>>"%temp%\info.txt" (
for /f "delims=" %%a in ('ver') do set "token=%%a"
setlocal EnableDelayedExpansion
echo !LocaleName! | find /I "-ES">nul && call :subst_spanish_acentos token
echo Windows version : !token!
echo Product name : !ProductName!, !bit! bit
echo Performance indicators : Processor Cores: !NUMBER_OF_PROCESSORS! Visible RAM: !ram! kilobytes&echo(
and add a new sub routineCode: Select all
:subst_spanish_acentos
set "token=!%1!"
set "token=!token: =á!"
set "token=!token:‚=é!"
set "token=!token:¡=í!"
set "token=!token:¢=ó!"
set "token=!token:£=ú!"
set "token=!token:¤=ñ!"
set "token=!token:¥=Ñ!"
set "%~1=%token%"
goto :eof
Now the output isCode: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Versión 6.2.9200]
Product name : Windows 8 Enterprise, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 8298772 kilobytes
Date/Time format : (dd/mm/yy) 08/09/2016 17:58:45,31
ComSpec : C:\Windows\system32\cmd.exe
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : es-ES Code Pages: OEM 850 ANSI 1252
DIR format : 08/09/2016 12:03 8.485.076.992 pagefile.sys
Permissions : Elevated Admin=Yes, Admin group=Yes
Missing from the tool collection: debug
douglas.swehla wrote:Code: Select all
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 6.1.7601]
Product name : Windows 7 Professional, 64 bit
Performance indicators : Processor Cores: 4 Visible RAM: 4072532 kilobytes
Date/Time format : mm/dd/yy (12 hours) Wed 08/31/2016 11:14:26.87
Extensions : system: Enabled user: Enabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 437 ANSI 1252
DIR format : 08/29/2016 09:46 AM 4,170,272,768 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
Missing from the tool collection: debug
I am able to use delayed expansion, so not sure what's up with that. When I have more time, I'll step through the code to see what's going on.
Code: Select all
set "du=Enabled"
setlocal EnableDelayedExpansion
if not "%du%" equ "!du!" set "du=Disabled"
(endlocal & set "du=%du%")
Code: Select all
:::::: Starts at line line 114 in version 09/07/2016. ::::::
:: Extensions and DelayedExpansion
for %%a in (es eu ds du) do set "%%a=Disabled"
if %RegUserCMDproc%==1 (call :RegUserProc) else if defined wmic call :WmiUserProc
if %RegSysCMDproc%==1 (call :RegSysProc) else if defined wmic call :WmiSysProc
if not defined eu set "eu=%ex_noreg%"
if not defined du set "du=%de_noreg%"
:::::: Starts at line 270 in version 09/07/2016. ::::::
:RegUserProc
%reg% query "HKCU\%CMDproc%" /v "EnableExtensions" 2>nul|%find% "0x1">nul && set "eu=Enabled "
%reg% query "HKCU\%CMDproc%" /v "DelayedExpansion" 2>nul|%find% "0x1">nul && set "du=Enabled "
goto :eof
:WmiUserProc
%RegHead% GetDWORDValue hDefKey^="&H%HKCU%" sSubKeyName^="%CMDproc%" sValueName^="EnableExtensions" %RegTail%
if "%dat%"=="1" set "eu=Enabled "
%RegHead% GetDWORDValue hDefKey^="&H%HKCU%" sSubKeyName^="%CMDproc%" sValueName^="DelayedExpansion" %RegTail%
if "%dat%"=="1" set "du=Enabled "
goto :eof
:RegSysProc
%reg% query "HKLM\%CMDproc%" /v "EnableExtensions" 2>nul|%find% "0x1">nul && set "es=Enabled "
%reg% query "HKLM\%CMDproc%" /v "DelayedExpansion" 2>nul|%find% "0x1">nul && set "ds=Enabled "
goto :eof
:WmiSysProc
%RegHead% GetDWORDValue hDefKey^="&H%HKLM%" sSubKeyName^="%CMDproc%" sValueName^="EnableExtensions" %RegTail%
if "%dat%"=="1" set "es=Enabled "
%RegHead% GetDWORDValue hDefKey^="&H%HKLM%" sSubKeyName^="%CMDproc%" sValueName^="DelayedExpansion" %RegTail%
if "%dat%"=="1" set "ds=Enabled "
goto :eof