Jump to content

Replacing Notepad problem


Recommended Posts

I use the below batch file to replace Notepad with Notepad2. It works fine after install but not unattended.

I do it with the <FirstLogonCommands> section in the oobeSystem pass. I have other synchronous commands that work fine but not this one.

The problem is with takeown or icacls.

At this stage of install the <FirstLogonCommands> are launched with elevated privileges. Either of those commands with elevated privileges must be the problem.

The notepad.original.exe files do get created but that's it.

I can't do any vmware testing because my s754 amd64 does not allow a guest 64bit OS, only a host. It's an early revision that has that limitation.

Testing requires burning a DVD and reinstalling.

Any ideas?

@echo off

cd /d %~dp0

takeown /f %Systemroot%\notepad.exe
takeown /f %Systemroot%\System32\notepad.exe
icacls %Systemroot%\notepad.exe /grant "%username%":f
icacls %Systemroot%\System32\notepad.exe /grant "%username%":f
::IF EXIST %SYSTEMROOT%\SysWOW64 (bcdedit.exe -set loadoptions "DDISABLE_INTEGRITY_CHECKS")

copy %Systemroot%\notepad.exe %Systemroot%\notepad.original.exe
copy %Systemroot%\System32\notepad.exe %Systemroot%\System32\notepad.original.exe

copy notepad2.exe %Systemroot%\notepad.exe /y
copy notepad2.exe %systemroot%\System32\notepad.exe /y

exit

Link to comment
Share on other sites


i think its easier to replace the original notepad.ex_ located in i386 folder with notepad2 file. of course you'd have to rename and cab the notepad2 file.

EDIT: sorry, i see your talkinkg about vista, so this method doesnt work.

Edited by zeko
Link to comment
Share on other sites

Yep, easiest solution is to mount your wim, inside the windows dir & system 32 folder simply replace your vers of notepad & rename it to notepad.exe not cabbed with the current vista notepad.exe. I have done this countless times no problems.

Edited by MAVERICKS CHOICE
Link to comment
Share on other sites

Yep, easiest solution is to mount your wim, inside the windows dir & system 32 folder simply replace your vers of notepad & rename it to notepad.exe not cabbed with the current vista notepad.exe. I have done this countless times no problems.

Yes, thats the way to do it, i replace more files there witout any problems.

Link to comment
Share on other sites

@ Zeko

You could have a look around for just the waik tools & if running xp sp2 & put all the tools in the windows/system32 dir, just right click & install the inf in the package. Theres plenty of info how to mount wims on this board.

Edited by MAVERICKS CHOICE
Link to comment
Share on other sites

Yep, easiest solution is to mount your wim, inside the windows dir & system 32 folder simply replace your vers of notepad & rename it to notepad.exe not cabbed with the current vista notepad.exe. I have done this countless times no problems.

Thanks for the advice. It was actually easier then I thought it would be. Worked like a charm.

zeko: please don't hijack this thread. Start your own if you have questions.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...