Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Sign in to follow this  
jaws75

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

ok, i see it can be done with vista, too. now,, can wim image be mounted on xp partition? which tool to use?

Share this post


Link to post
Share on other sites
Windows AIK (Windows Automated Installation Kit)

hey,sp00f, thanks for the reply, but that win aik thing is huge to dl. anything else?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Will this replacement method (mounting WIM and replacing apps) work for any app that you want to replace? In particular, I want to use xplorer2 in place of Windows explorer....and the companion editor2 for notepad....

Edited by John L. Galt

Share this post


Link to post
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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×