Recommended Posts

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

Edited by mcovey
Link to comment
https://www.neowin.net/forum/topic/236641-replace-notepad/
Share on other sites

What is this?

ping -n 2 127.0.0.1 >NUL

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:

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).

Edited by bsquirle

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.

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

Windows shell scripting (aka batch scripting).

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.

@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

mkdir C:\temporaryoldnotepadfolder

this makes a directory in C: called temporaryoldnotepadfolder to put your old notepad in temporarily.

copy C:\Windows\System32\notepad.exe C:\temporaryoldnotepadfolder

this copies your old notepad to this new folder

move /y %1 notepad.exe

this renames whatever file you drag/dropped onto the batch file to notepad.exe

move notepad.exe C:\

this puts the new notepad.exe in C:

pause

this pauses so that you must agree to continue by pressing any key

REM DIRTY WORK BEGINS HERE

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

echo Beginning...

prints "beginning" on the screen

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.

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.

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.

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.

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:\

Edited by mcovey
off topic--

Where did you learn to write this stuff?

--off topic

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.

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

584817889[/snapback]

:spam:

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.

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 :

net send LocalHost

any help appreciated thanx

post-79922-1099948689.jpg

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 :

net send LocalHost

any help appreciated thanx

584886578[/snapback]

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • There is a lot of reasons not to use Edge but faster fixes and security updates is not one of them.
    • Can't reproduce. I installed Edge, went to neowin.net > accepted the cookie consent > used menu to go to forums, everything loads and I can browse around the forums. If you can't interact with the dialog on the forums for some reason, go to the main site and accept the cookie consent there? It is true that the site will not function properly until the cookie consent is accepted or rejected,. it's a legal requirement and I also know that certain VPN/ad blockers block it, which is a user related issue and not a neowin.net problem.   This is not our cookie consent dialog. Gotta love browser hijacking... /s Edit: this may be what Californians see, I will confirm with our consent provider.
    • Google Chrome 149.0.7827.115 (offline installer) by Razvan Serea The web browser is arguably the most important piece of software on your computer. You spend much of your time online inside a browser: when you search, chat, email, shop, bank, read the news, and watch videos online, you often do all this using a browser. Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. Use one box for everything--type in the address bar and get suggestions for both search and Web pages. Thumbnails of your top sites let you access your favorite pages instantly with lightning speed from any new tab. Desktop shortcuts allow you to launch your favorite Web apps straight from your desktop. Chrome has many useful features built in, including automatic full-page translation and access to thousands of apps, extensions, and themes from the Chrome Web Store. Google Chrome is one of the best solutions for Internet browsing giving you high level of security, speed and great features. Important to know! The offline installer links do not include the automatic update feature. Download web installer: Google Chrome Web 32-bit | Google Chrome 64-bit | Freeware Download: Google Chrome Offline Installer 64-bit | Direct Link | 131.0 MB Download: Google Chrome Offline Installer 32-bit | Direct Link | 119.0 MB Download page: Google Chrome Portable Download: Chrome ARM64 | Direct Link View: Chrome Website | Release Notes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Oh, it's happening on more than one dialog? This is the dialog that I'm unable to interact with.
    • WSCC - Windows System Control Center 10.0.3.8 by Razvan Serea Windows System Control Center is a free, portable program that allows you to install, update, execute and organize the utilities from various system utility suites. WSCC can install and update the supported utilities automatically. Alternatively, WSCC can use the http protocol to download and run the programs. WSCC is portable, installation is not required. Extract the content of the downloaded zip archive to any directory on your computer. Free for personal use. The setup packages and updates are downloaded directly from their author's website! This edition of WSCC supports the following utility suites: Windows Sysinternals Suite (including support for "Sysinternals Live" service) NirSoft Utilities Mitec and more... WSCC - Windows System Control Center 10.0.3.8 changelog: [NEW] update progress is now visible on the Windows taskbar [FIXED] fixed an issue with the Update dialog [FIXED] minor fixes Download: WSCC (64-bit) | 5.4 MB (Free for personal use) Download: WSCC (32-bit) | 6.3 MB View: WSCC Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
    • Week One Done
      Timaximus earned a badge
      Week One Done
    • Rookie
      FBSPL went up a rank
      Rookie
    • First Post
      davidbazooked earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      492
    2. 2
      PsYcHoKiLLa
      170
    3. 3
      +Edouard
      164
    4. 4
      Steven P.
      85
    5. 5
      ATLien_0
      77
  • Tell a friend

    Love Neowin? Tell a friend!