How to replace windows 7 system files ?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
polas
Posts: 1
Joined: 12 Sep 2013 04:46

How to replace windows 7 system files ?

#1 Post by polas » 12 Sep 2013 04:58

Hi I am a newbie so do not ask what and how.
because of limited knowledge of bat programming.

The thing that I want to move the file system successfully copying the explorer.exe explorer.exe_old
and believed to rename it by creating the limbs. old

How do I do that so successfully copied and renamed?
Here's what I tried to change but without accomplishing anything.

Code: Select all

cd c:\
copy explorer.exe c:\windows
cd \windows
rename c:\windows\explorer.exe explorer.exe_old
pause
echo File successfully swapped.


And it says that the system file cannot find the path and of course i got access denied when tried to copy to c:\windows and replace.

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to replace windows 7 system files ?

#2 Post by ShadowThief » 12 Sep 2013 20:02

First of all, I would strongly advise against altering any system files unless you know what you're doing.

Second, you should rename the old explorer.exe first and then move the new explorer.exe. Right now you're overwriting the old file and renaming the new file, which is not what you want to do.

Code: Select all

ren C:\Windows\explorer.exe C:\Windows\explorer.old
copy C:\explorer.exe C:\Windows\explorer
echo File swapped
pause


Finally, try running the command prompt as an administrator (If you're using Windows 7, search for cmd in "Search for programs and files," right-click it, and select "Run as Administrator")

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How to replace windows 7 system files ?

#3 Post by foxidrive » 12 Sep 2013 22:18

polas wrote:Hi I am a newbie so do not ask what and how.
because of limited knowledge of bat programming.


Then why are you trying to replace system files???

Windows has a file protection mechanism built in to start with...

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: How to replace windows 7 system files ?

#4 Post by Dos_Probie » 16 Sep 2013 16:24

For Those of Us that DO know what we are doing, this is what I have been using successfully for Win7 and Win8.. 8)

Code: Select all

 @set @jscript=1/*
 @echo off&color 4f&set cd /d=%~dp0&mode con: cols=73 lines=4&&title[~ REPLACE SYSTEM FILES ~]

:: ### ADMIN CHECK
 reg query "hku\S-1-5-19" >nul 2>&1 || (
   @cscript //e:jscript //nologo "%~f0" "%~f0"
   goto :eof
 )

:: ### MODIFY AND REPLACE WINDOWS PROTECTED O.S. FILES ###
:: Place your modded file in same directory with this batch file!
:: 1. Takes ownership then taskkill of system target file.
:: 2. Disables the software protection service.
:: 3. Appends end of existing file for possible future restore.
:: 4. Copies source file to target destination, effectively replacing original file.
:: 5. Re-enables software protection service and system target file.

 :: ### VARIABLES
set cpy=xcopy /qy
set file1=explorer.exe
set path1=%systemroot%

 :: ### OWNERSHIP OF EXPLORER.EXE
takeown /a /f %path1%\%file1%>nul&icacls %path1%\%file1% /Grant *S-1-5-32-544:F>nul

 :: ### KILL FILE PROTECTION SERVICE AND EXPLORER.EXE
taskkill /f /im sppsvc /t>nul 2>&1&net stop sppsvc>nul 2>&1
echo. Stopping The Software Protection Service and Explorer.exe..
taskkill /f /im %file1%>nul
timeout /t 2 /nobreak>nul

 :: ### MOVE THEN RENAME EXPLORER.EXE FIRST
move "%path1%\%file1%" "%tmp%\">nul&ren "%tmp%\explorer.exe" "explorer.exe.Org"
move "%tmp%\explorer.exe.Org" "%path1%\">nul

 :: ### COPY PATCHED EXPLORER.EXE
%cpy% "%~dp0explorer.exe" "%path1%\">nul

 :: ### RESTORE OWNERSHIP
cls
echo. Modifying and Replacing System Files..Resetting Permissions
icacls "%path1%\%file1%" /setowner "NT Service\TrustedInstaller" /T /C>nul 2>&1
timeout /t 2 /nobreak>nul

 :: ### RESTART APPS & SERVICES
net start sppsvc>nul
cls
echo. Almost Done!..Restarting Explorer.exe and Software Protection Service..
timeout /t 3 /nobreak>nul
start %file1%&exit /b

:eof
 // ### RUN AS ADMINISTRATOR
 */
 var strArg = WScript.Arguments(0);
 var objSH = WScript.CreateObject("Shell.Application");
 objSH.ShellExecute(strArg, "", "", "runas", "5");




ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to replace windows 7 system files ?

#5 Post by ShadowThief » 17 Sep 2013 17:01

Just out of curiosity, why ARE you replacing system files?

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: How to replace windows 7 system files ?

#6 Post by Dos_Probie » 21 Sep 2013 07:52

One thing the OP needs to be aware of is the fact that even if he or she is successful patching a system file
it's not a permanment soulution as Windows updates or future service packs will just change it back again..DP 8)

Post Reply