Help - Search - Members - Calendar
Full Version: replace notepad
Neowin Forums > Help & Discussion Center > A Collection of Essential Guides
mcovey
I wrote a batch file that replaced notepad with another file, its very handy because all the guides ive seen ask you to do it manually which isnt very intuitive.

its at http://kafene.org/scripts/notepad.bat

just drag and drop your replacement onto it, no renaming necessary and read the one instruction.

here's a post about it in my blog
ozgeek
What is this?

CODE
ping -n 2 127.0.0.1 >NUL
Manuroc
im not an expert at this, but doesnt that line continually make you ping yourself? if thats the case, wouldnt that slow down your computer a lot? or maybe im just wrong. unsure.gif
Advance
I hate being a newb, but this stuff really interests me, what 'language' is it?
AaronMT
Quote - (Advance @ Nov 1 2004, 11:44)
I hate being a newb, but this stuff really interests me, what 'language' is it?
[snapback]584844658[/snapback]


I would not run this if I were you.

Looks like a script kiddie is getting some giggles over people flooding their computer.
lylesback2
ahhh!

especially someone with 14 posts? i do not trust this what so ever.
Veiva
U R T3h N00BIE W00bIe, f00l!!!!!!!!!11111111111oneoneelven!!lol

Haha, I always look at batch files before I open them, even from legit sources.

So:

Report

Why'd you want to do something like this, script kiddie?
moloko
Thats pretty cool. Personally I just go to files and select .txt to be opened by my editor of choice. But for those that can't do that stuff, this is a good option if its a valid BAT file.
bsquirle
Quote - (winxptwker @ Nov 1 2004, 18:06)
What is this?

CODE
ping -n 2 127.0.0.1 >NUL

[snapback]584844495[/snapback]

It just makes the computer wait a VERY little bit.

I don't know why, it certainly isn't needed.

Also,
Why did he make that batch file that long??????

Anyway, I won't be using it.
But it might be helpfull for some people.


EDIT:
CODE
ping -n 20 127.0.0.1 >NUL


Seems like he wants us to think he's doing a lot of work.
But it won't hurt you or your computer, it just slows down the process (+-20 seconds).
edbro
All you have to do is copy your replacement "notepad.exe" into Windows\system32\dllcache and \system32. Windows will ask for your install CD and you simply tell "no thank you" and to accept the new file.
hurting101
Please stop spreading FUD: just because you don't understand something doesn't mean it's malicious.

The ping command pauses the script for one second. That's it. The OP probably used it for something related to file protection, but I don't see why it's needed.

Quote -
I hate being a newb, but this stuff really interests me, what 'language' is it?

Windows shell scripting (aka batch scripting).
Advance
Hmm ok thanks, I will look into it.
mcovey
it's not malicious. im not a script kiddie or a newbie nerd either.
I write batch files to make my life easier.

the ping simply pauses it. there's no way to pause a terminal for a certain amount of time, but if you go too fast, the file gets an in use error, and if you go too slow then the old notepad gets put back from a replacement. Here, I'll do a description of what all the code does.

CODE
@echo off
echo READ THIS:
echo ..
echo NOTE: just in case, a copy of your old notepad.exe has been made in C:\. this will make a copy of Notepad.exe in your C: folder. WARNING: please ensure neither notepad nor your replacement file are running.
echo ..
echo ..
echo  if you stop this prematurely, there will be a new directory in C: called temporaryoldnotepadfolder. It's safe to delete.
echo ..
echo ..
echo ..

these lines simply send you a warning/notice. the only command used is echo
CODE
mkdir C:\temporaryoldnotepadfolder

this makes a directory in C: called temporaryoldnotepadfolder to put your old notepad in temporarily.
CODE
copy C:\Windows\System32\notepad.exe C:\temporaryoldnotepadfolder

this copies your old notepad to this new folder
CODE
move /y %1 notepad.exe

this renames whatever file you drag/dropped onto the batch file to notepad.exe
CODE
move notepad.exe C:\

this puts the new notepad.exe in C:
CODE
pause

this pauses so that you must agree to continue by pressing any key
CODE
REM DIRTY WORK BEGINS HERE

this is like a comment to just say, here begins the replacing.
CODE
echo Beginning...

prints "beginning" on the screen
CODE
ping -n 2 127.0.0.1 >NUL

this pings your local ethernet card for two seconds to create a delay so the file is not in use at the time this command executes. it points the traffic at NUL which is the windows equivalent of /dev/null in unix. I won't explain this line again.
CODE
copy C:\notepad.exe C:\Windows
ping -n 2 127.0.0.1 >NUL
copy C:\notepad.exe C:\WINDOWS\System32
ping -n 2 127.0.0.1 >NUL
copy C:\notepad.exe C:\WINDOWS\ServicePackFiles\i386
ping -n 2 127.0.0.1 >NUL
copy C:\notepad.exe C:\WINDOWS\System32\dllcache
ping -n 2 127.0.0.1 >NUL

this copies the notepad.exe file that was created with more 2 second pauses.
CODE
echo If you received the message "1 file(s) copied." 4 times, this was a success. wait until this is done, then go to start, then run and type notepad, and it should launch your new notepad.
ping -n 2 127.0.0.1 >NUL

this prints a message so that the user can check whether or not the script completed successfully.
CODE
del C:\notepad.exe
move /Y C:\temporaryoldnotepadfolder\notepad.exe C:\
rmdir C:\temporaryoldnotepadfolder\
ping -n 20 127.0.0.1 >NUL

this moves deletes the copy of the new notepad that was made in C: and moves the old notepad that was backed up into C: then it removes the temporaryoldnotepadfolder that was made earlier and waits 20 seconds before closing in case you're still reading that message above.
CODE
REM THIS FILE IS LICENSED UNDER THE CREATIVE COMMONS Attribution-NonCommercial-ShareAlike 2.0
REM YOU CAN READ THE DEED AT: http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
REM OR THE FULL TEXT OF THE LICENSE AT: http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode

that's just my license code


EDIT:
i just updated the code to do backup work in %TMP% instead of C: and move things to "\windows" in case your main drive isn't C:\
Advance
off topic--

Where did you learn to write this stuff?

--off topic
mcovey
Quote - (Advance @ Nov 3 2004, 22:49)
off topic--

Where did you learn to write this stuff?

--off topic
[snapback]584859081[/snapback]


a general knowledge of the windows command line is all it takes. there's no syntax or anything like in C or PHP (im not spectacular at either)...

if you want to try something just open up notepad and type some commands.

you need "@echo off" first which makes it soo that when you type "echo hello" it doesnt write the word echo.

try doing this:
@echo off
cd C:
echo Hello world! >new.txt

all that does is shove the words "Hello world!" into a file called new.txt in C:
if you type "edit new.txt" or just open it in notepad, it will be there. then press alt+f and "x" to exit.

some commands are like:

del
move
copy
ping
tracert
net (net is VERY useful for almost all system related tasks like users and stuff)
edit
rename
telnet
ftp
tree
dir

there's tons more. these are all in reality little programs that do things. not many people think of "dir" as a program but it is indeed a program that simply lists the contents of a directory. In linux the "ls" command is very similar. if you'd like to see the source code for the ls program you can google "coreutils" and download the source. you'll need something like 7zip or winrar to unzip it. it's very simple.

if you can (service pack 1 or 2 disabled it) try "net send localhost hello" it will make a little box pop up that says "hello" in it.
Advance
I might be looking into that, thanks a bunch!
Hankyone
learn MSDOS and you will learn batch files in the same time wink.gif
nearly all the same commands exept exclusif .bat commands like "CHOICE /c:1234" or "CALL" and more
kizzaaa
Quote - (mcovey @ Oct 28 2004, 09:18)
I wrote a batch file that replaced notepad with another file, its very handy because all the guides ive seen ask you to do it manually which isnt very intuitive.

its at http://kafene.org/scripts/notepad.bat

just drag and drop your replacement onto it, no renaming necessary and read the one instruction.

here's a post about it in my blog
[snapback]584817889[/snapback]


diespam.gif
empty
ahah, i love all the "tech" guys in the first few posts and their lame explanations! better answer the clue phone boys. thanks for the script, care to reccomend a good notepad alt?
Advance
I personally hacked mine up, and then used this to replace it! Worked like a charm.
siddhs
Who says that a 16 post "dude" cannot write a batch file program and help others...

Wake Up before you blame someone........

Good Job mcovey

-Siddhs
Damnation Virus
Quote - (mcovey @ Nov 3 2004, 18:06)
if you can (service pack 1 or 2 disabled it) try "net send localhost hello" it will make a little box pop up that says "hello" in it.
[snapback]584859187[/snapback]


I want to know how to insert a break in a net send. In other words... i want to make a file that will send the message.... skip a line (or as many lines as i choose) and write some more text.... and the message alert pop-up will appear like this:


|------------------------------------------------------------------------------
|Messenger Service
|-------------------------------------------------------------------------------
|Message from LocalHost to LocalHost on 11/8/2004 2:15:18 PM
|
|Hi
|
|This is a crap message
|Feel Free to ignore it because it is just an example |
|
| ----------------
| | OK |
| ----------------


I have no idea how to do this beyond :
CODE
net send LocalHost

any help appreciated thanx
Damnation Virus
Click to view attachment
Quote - (Damnation Virus @ Nov 8 2004, 15:20)
I want to know how to insert a break in a net send. In other words... i want to make a file that will send the message.... skip a line (or as many lines as i choose) and write some more text.... and the message alert pop-up will appear like this attachment which was made with NET SEND SPOOFER but i want to make the code WITHOUT an ASSISTANT PROGRAM.
             
I have no idea how to do this beyond :
CODE
net send LocalHost

any help appreciated thanx
[snapback]584886578[/snapback]
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.