1) Certain commands are missing or if they have the wrong extension (say a .bat extension)
2) and also report if certain essential items on the PATH statement are missing.
I've implemented 2) below and added a check for permissions (Hmmm, it may have a bug in user mode)
Just adding here that this script concept as it stands is not an "Official" DosTips script and the people running it will always need to be aware of that.
For those watching around now I've edited numerous times and played with the formatting too.
Code: Select all
Windows version : Microsoft Windows [Version 6.3.9600]
Product name : 32 bit Windows 8.1 Pro with Media Center
Processor arch : x86, CPU/Number of cores=8
Date/Time format : dd/mm/yy (24 hours) Sat 13/08/2016 20:03:24.57
Extensions : system:Enabled user:Enabled
Delayed expansion : system:Disabled user:Disabled
Locale name : en-AU Code Pages:OEM 850 ANSI 1252
DIR format : 11/08/2016 02:05 3,484,418,048 pagefile.sys
Permissions : Elevated Admin=No, Admin access=Yes, User access=No
Missing from the PATH statement: C:\WINDOWS\system32
Missing from the PATH statement: C:\WINDOWS\System32\Wbem
Code: Select all
@echo off &setlocal EnableExtensions DisableDelayedExpansion
:: prepare some variables to shorten lines in the script
set "International=HKCU\Control Panel\International"
set "CurrentVersion=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
set "CodePage=HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage"
set "CMDproc=Software\Microsoft\Command Processor"
:: Checks for user permissions
set "Admin=No" & set "A-access=No" & set "user=Yes"
cd "%windir%\system32\config" >nul 2>&1 && (set "A-access=Yes" & set "user=No")
reg query "HKU\S-1-5-19" >NUL 2>&1 && (set "Admin=Yes" & set "A-access=No" & set "user=No")
:: checks path
:: removes random double quotes, adds double quotes, removes trailing slash
set "p=%path%"
set p=%p:"=%
set p=%p:;=" "%
set p=%p:\"="%
set p="%p%"
:: echo debug &echo.&echo "%p%" & (for %%a in ("%p%") do echo %%a) & pause & goto :EOF
:: Checks for certain path elements and reports if they are missing
set "p-1=%windir%"
set "p-2=%windir%\system32"
set "p-3=%windir%\System32\Wbem"
for %%a in (%p%) do (
if /i "%%~a"=="%p-1%" set "p-1=%p-1%.yes"
if /i "%%~a"=="%p-2%" set "p-2=%p-2%.yes"
if /i "%%~a"=="%p-3%" set "p-3=%p-3%.yes"
)
set "cores=%NUMBER_OF_PROCESSORS%" & set "arch=%PROCESSOR_ARCHITECTURE%"
set "pad= "
:: Check for 64 bit windows. Defaults to 32 bit
set bit=32 bit
if exist "%SystemRoot%\SysWOW64\" set bit=64 bit
:: create a set of many varibles: checking date and time formats is one use
for /f "tokens=1,2,*" %%a in ('reg query "%International%"^|find "REG_"') do set "%%a=%%c"
if "%iDate%"=="0" (set format=mm/dd/yy) else if "%iDate%"=="1" (set format=dd/mm/yy) else if "%iDate%"=="2" (set format=yy/mm/dd)
if "%iTime%"=="0" (set hours=12) else if "%iTime%"=="1" (set hours=24)
:: get the DIR command format to display
for /f "delims=" %%a in ('dir "%SystemDrive%\pagefile.sys" /a ^|find ":"') do set DirFormat=%%a
:: determines the state of delayed expansion and extensions
for %%a in (es eu ds du) do set "%%a=Disabled"
reg query "HKLM\%CMDproc%" /v "EnableExtensions" 2>nul|find "0x1">nul && set "es=Enabled "
reg query "HKCU\%CMDproc%" /v "EnableExtensions" 2>nul|find "0x1">nul && set "eu=Enabled "
reg query "HKLM\%CMDproc%" /v "DelayedExpansion" 2>nul|find "0x1">nul && set "ds=Enabled "
reg query "HKCU\%CMDproc%" /v "DelayedExpansion" 2>nul|find "0x1">nul && set "du=Enabled "
:: create the information file and send the information to the clipboard if clip is available
>"%temp%\info.txt" (
echo [code^]
for /f "delims=" %%a in ('ver') do echo Windows version : %%a
for /f "tokens=2*" %%a in ('
reg query "%CurrentVersion%"^|find /i "ProductName"') do echo Product name : %Bit% %%b
echo Processor arch : %arch%, CPU/Number of cores=%cores%&echo(
echo Date/Time format : %format% (%hours% hours^) %date% %time%
for /f "tokens=3" %%a in ('reg query "%CodePage%" /v "OEMCP"') do (
for /f "tokens=3" %%b in ('reg query "%CodePage%" /v "ACP"') do (
echo Extensions : system:%es% user:%eu%
echo Delayed expansion : system:%ds% user:%du%
echo Locale name : %LocaleName% Code Pages:OEM %%a ANSI %%b))
echo DIR format : %DirFormat%
echo Permissions : Elevated Admin=%Admin%, Admin access=%A-access%, User access=%user%&echo(
rem report if path elements are missing
for %%a in ("%p-1%" "%p-2%" "%p-3%") do (
if /i not "%%~xa"==".yes" echo.%pad%Missing from the PATH statement: %%~a
)
echo [/code^]
)
clip >nul 2>&1 && clip < "%temp%\info.txt"
:: load the information into Notepad where it can also be copied to the clipboard
start "" notepad.exe "%temp%\info.txt" & ping -n 2 localhost>nul & del "%temp%\info.txt"