From aea037d133d1b4d667d3ca4c2e006943181a96e1 Mon Sep 17 00:00:00 2001 From: wandersick Date: Tue, 24 Oct 2017 00:14:42 +0800 Subject: [PATCH] Add files via upload --- #Readme.txt | 9 +++++++-- Data/_determine_admin_group_name.vbs | 16 ++++++++++++++++ englishize.bat | 14 +++++++++----- restore.bat | 17 +++++++++++------ test.bat | 4 ++++ 5 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 Data/_determine_admin_group_name.vbs create mode 100644 test.bat diff --git a/#Readme.txt b/#Readme.txt index 483b78c..a018131 100644 --- a/#Readme.txt +++ b/#Readme.txt @@ -1,5 +1,5 @@ - [ Englishize Cmd v1.5 ] + [ Englishize Cmd v1.6a ] http://wandersick.blogspot.com | wandersick@gmail.com @@ -20,7 +20,7 @@ . Administrator rights are required. It asks for rights to elevates itself. Does not elevate over network mapped drives however. - . Windows Vista or above only (Windows Vista/7/8, Server 2008/R2/8/2012) + . Windows Vista or above only (Windows Vista/7/8/8.1, Server 2008/2012[R2]) [ Instructions ] @@ -57,6 +57,11 @@ [ Releases ] + v1.6a A quick fix to improve the last version. + v1.6 Fixed bug in some non-English localized versions of Windows + where 'Administrators' group account is named something else. + Thanks Markus (echalone). + Confirmed working in Windows 8.1. v1.5 Support for mui files under %systemroot%\syswow64. Restorer now restores original permissions and ownership Confirmed working in Windows 8. Updated with new CLI tools. diff --git a/Data/_determine_admin_group_name.vbs b/Data/_determine_admin_group_name.vbs new file mode 100644 index 0000000..8aec509 --- /dev/null +++ b/Data/_determine_admin_group_name.vbs @@ -0,0 +1,16 @@ +' For more info, see below web page: +' http://blogs.technet.com/b/heyscriptingguy/archive/2005/11/02/how-can-i-determine-the-name-of-the-local-administrators-group.aspx + +Dim strComputer, objWMIService, colAccounts, objAccount +On Error Resume Next + +strComputer = "." + +Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") + +Set colAccounts = objWMIService.ExecQuery _ + ("Select * From Win32_Group Where LocalAccount = TRUE And SID = 'S-1-5-32-544'") + +For Each objAccount in colAccounts + Wscript.Echo objAccount.Name +Next \ No newline at end of file diff --git a/englishize.bat b/englishize.bat index ed03093..984e6ed 100644 --- a/englishize.bat +++ b/englishize.bat @@ -49,18 +49,22 @@ if %errorlevel% EQU 0 ( ) :skipAdminCheck +:: acquire admin group account name + +for /f "usebackq tokens=* delims=" %%i in (`cscript //NoLogo ".\Data\_determine_admin_group_name.vbs"`) do set adminGroupName=%%i + cls -title Englishize Cmd v1.5 +title Englishize Cmd v1.6a echo. echo. -echo [ Englishize Cmd v1.5 ] +echo [ Englishize Cmd v1.6a ] echo. echo. echo # This script changes command line interface to English. echo. -echo # Designed for localized non-English Windows 7/Vista. All languages supported. +echo # Designed for localized non-English Windows Vista or above. Any languages. echo. echo # Note 1. A few programs without a .mui aren't affected, e.g. xcopy echo. @@ -84,7 +88,7 @@ for /f "usebackq" %%i in ("_files_to_process.txt") do ( @for /f "usebackq" %%m in ("_lang_codes.txt") do ( @if exist "%systemroot%\SysWoW64\%%m\%%i.mui" ( takeown /a /f "%systemroot%\SysWoW64\%%m\%%i.mui" - cacls "%systemroot%\SysWoW64\%%m\%%i.mui" /E /G administrators:F + cacls "%systemroot%\SysWoW64\%%m\%%i.mui" /E /G "%adminGroupName%":F ren "%systemroot%\SysWoW64\%%m\%%i.mui" "%%i.mui.disabled" ) ) @@ -99,7 +103,7 @@ for /f "usebackq" %%i in ("_files_to_process.txt") do ( @for /f "usebackq" %%m in ("_lang_codes.txt") do ( @if exist "%systemroot%\System32\%%m\%%i.mui" ( takeown /a /f "%systemroot%\System32\%%m\%%i.mui" - cacls "%systemroot%\System32\%%m\%%i.mui" /E /G administrators:F + cacls "%systemroot%\System32\%%m\%%i.mui" /E /G "%adminGroupName%":F ren "%systemroot%\System32\%%m\%%i.mui" "%%i.mui.disabled" ) ) diff --git a/restore.bat b/restore.bat index 39b8a6c..5ef6158 100644 --- a/restore.bat +++ b/restore.bat @@ -49,11 +49,16 @@ if %errorlevel% EQU 0 ( ) :skipAdminCheck +:: acquire admin group account name + +for /f "usebackq tokens=* delims=" %%i in (`cscript //NoLogo ".\Data\_determine_admin_group_name.vbs"`) do set adminGroupName=%%i + + cls -title Englishize Cmd v1.5 +title Englishize Cmd v1.6a echo. echo. -echo [ Englishize Cmd v1.5 ] +echo [ Englishize Cmd v1.6a ] echo. echo. echo # This script restores the command line interface back to original @@ -73,16 +78,16 @@ for /f "usebackq" %%i in ("_files_to_process.txt") do ( icacls "%systemroot%\System32\%%m\%%i.mui" /setowner "NT Service\TrustedInstaller" /C REM the below output is probably an error, hence muted to avoid confusion as redirection probably handled it if exist "%systemroot%\SysWoW64\%%m\%%i.mui" @icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /setowner "NT Service\TrustedInstaller" /C >nul 2>&1 - icacls "%systemroot%\System32\%%m\%%i.mui" /grant:r Administrators:^(RX^) /inheritance:d - if exist "%systemroot%\SysWoW64\%%m\%%i.mui" @icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /grant:r Administrators:^(RX^) /inheritance:d >nul 2>&1 + icacls "%systemroot%\System32\%%m\%%i.mui" /grant:r "%adminGroupName%":^(RX^) /inheritance:d + if exist "%systemroot%\SysWoW64\%%m\%%i.mui" @icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /grant:r "%adminGroupName%":^(RX^) /inheritance:d >nul 2>&1 ) if exist "%systemroot%\SysWoW64\%%m\%%i.mui.disabled" ( ren "%systemroot%\SysWoW64\%%m\%%i.mui.disabled" "%%i.mui" if exist "%systemroot%\System32\%%m\%%i.mui.disabled" @ren "%systemroot%\System32\%%m\%%i.mui.disabled" "%%i.mui" icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /setowner "NT Service\TrustedInstaller" /C if exist "%systemroot%\System32\%%m\%%i.mui" @icacls "%systemroot%\System32\%%m\%%i.mui" /setowner "NT Service\TrustedInstaller" /C >nul 2>&1 - icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /grant:r Administrators:^(RX^) /inheritance:d - if exist "%systemroot%\System32\%%m\%%i.mui" @icacls "%systemroot%\System32\%%m\%%i.mui" /grant:r Administrators:^(RX^) /inheritance:d >nul 2>&1 + icacls "%systemroot%\SysWoW64\%%m\%%i.mui" /grant:r "%adminGroupName%":^(RX^) /inheritance:d + if exist "%systemroot%\System32\%%m\%%i.mui" @icacls "%systemroot%\System32\%%m\%%i.mui" /grant:r "%adminGroupName%":^(RX^) /inheritance:d >nul 2>&1 ) ) ) diff --git a/test.bat b/test.bat new file mode 100644 index 0000000..71e8fb1 --- /dev/null +++ b/test.bat @@ -0,0 +1,4 @@ +@echo off +for /f "usebackq tokens=* delims=" %%i in (`cscript //NoLogo ".\Data\_determine_admin_group_name.vbs"`) do set lala=%%i +echo lala = "%lala%" +pause \ No newline at end of file