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

    • I disagree here sorry. The majority of their customers are corporations who are locked in to their eco system and have no choice. Private individuals don't contribute that much to their income.
    • Weekend PC Game Deals: Anno 117, Final Fantasy VII, Rematch, and more by Pulasthi Ariyasinghe Weekend PC Game Deals is where the hottest gaming deals from all over the internet are gathered into one place every week for your consumption. So kick back, relax, and hold on to your wallets. The Epic Games Store's mystery giveaways may have ended, but its regular freebies didn't miss a step this week. The double drop was for copies of Warhammer 40K Speed Freeks and The Ouroboros King. Speed Freeks lands for multiplayer racing fans, but with plenty of competitive shooting elements too. You will be piloting Ork buggies, tanks, and aircraft modeled after the popular tabletop miniatures while trying to complete objectives and pass finish lines. Next, Ouroboros King is a crossover between chess and tactical roguelikes, offering the chance to create your own army with special rules to beat incoming foes on the board. The double giveaway on the Epic Games Store will be available until June 11, and replacing it will be Citizen Sleeper and ROBOBEAT. The Humble Store brought a new charity bundle to check out this week too. Landing with the name The Complete Inkle Library, this is a large collection of interactive narrative puzzle games from the publisher Inkle. This begins with Heaven's Vault, four parts from the Sorcery series, 80 Days, Overboard, and Pendragon: Narrative Tactics within the starting tier for $9. Hopping up a step to the $12 tier gets you TR-49, Expelled, and A Highland Song for paying at least $12. If you go for the $20 tier, you get four e-books from the Heaven's Vault series. The bundle has almost three weeks on its counter before it goes away. Big Deals There is a larger than normal amount of weekend specials happening this time, including multiple publisher deals, franchise discounts, and indie gems to grab. With those and more, here's our hand-picked big deals list for the weekend: Anno 117: Pax Romana – $44.99 on Steam Clair Obscur: Expedition 33 – $39.99 on Steam Timberborn – $27.99 on Steam EARTH DEFENSE FORCE 6 – $26.39 on Steam Rust – $19.99 on Steam FINAL FANTASY VII REBIRTH – $19.99 on Steam Street Fighter 6 – $19.99 on Steam Returnal – $19.79 on Steam Shape of Dreams – $17.49 on Steam Far Cry 6 – $14.99 on Steam Assassin's Creed Valhalla – $14.99 on Steam Quarantine Zone: The Last Check – $14.99 on Steam REMATCH – $14.99 on Steam EA SPORTS FC 26 – $13.99 on Steam FINAL FANTASY VII REMAKE INTERGRADE – $13.99 on Steam Magicraft – $12.79 on Steam Cult of the Lamb – $12.49 on Steam Dying Light 2: Reloaded Edition – $11.99 on Steam Cuphead – $11.99 on Steam Assassin's Creed Odyssey – $11.99 on Steam Hunt: Showdown 1896 – $11.99 on Steam Sektori – $11.99 on Steam Just Shapes & Beats – $11.99 on Steam Gunfire Reborn – $10.99 on Steam 33 Immortals – $9.99 on Epic Store Baby Steps – $9.99 on Steam Sifu – $9.99 on Steam Hearts of Iron IV – $9.99 on Steam DREDGE – $9.99 on Steam DAVE THE DIVER – $9.99 on Steam Pacific Drive – $9.89 on Steam Mycopunk – $9.74 on Steam Sons Of The Forest – $8.99 on Steam Jotunnslayer: Hordes of Hel – $8.99 on Steam Nuclear Throne – $8.99 on Steam Mechabellum – $8.99 on Steam Deep Rock Galactic: Survivor – $8.44 on Steam TerraTech Legion – $7.99 on Steam Inscryption – $7.99 on Steam Assassin's Creed Unity – $7.49 on Steam Minishoot' Adventures – $7.49 on Steam The Stanley Parable – $7.49 on Steam Oxygen Not Included – $7.49 on Steam Megabonk – $6.99 on Steam Look Outside – $5.99 on Steam Vampire Hunters – $5.24 on Steam MOTHERGUNSHIP – $4.99 on Steam My Friend Pedro – $3.99 on Steam The Messenger – $3.99 on Steam Vampire Survivors – $3.74 on Steam Brotato – $2.99 on Steam Enter the Gungeon – $2.99 on Steam Loop Hero – $2.99 on Steam GRIS – $2.99 on Steam Exit the Gungeon – $2.49 on Steam Hitman: Absolution – $1.99 on Steam CARRION – $1.99 on Steam Don't Starve Together – $1.49 on Steam Golf With Your Friends – $1.49 on Steam Hotline Miami – $0.99 on Steam The Ouroboros King – $0 on Epic Store Warhammer 40K Speed Freeks – $0 on Epic Store DRM-free Specials Hopping over to the DRM-free deals, the GOG store has plenty of discounts running this weekend too. Here are some highlights: Fallout 4: Game of the Year Edition - $15.99 on GOG Fallout: New Vegas Ultimate Edition - $9.99 on GOG Disco Elysium - The Final Cut - $9.99 on GOG Crysis - $9.99 on GOG Tyranny - Standard Edition - $7.49 on GOG Frostpunk: Game of the Year Edition - $7.35 on GOG Banished - $6.79 on GOG Fallout 3: Game of the Year Edition - $6.59 on GOG The Forgotten City - $6.25 on GOG The Age of Decadence - $5.99 on GOG SimCity 3000 Unlimited - $4.99 on GOG Assassin's Creed: Director's Cut - $4.99 on GOG SimCity 4 Deluxe Edition - $3.99 on GOG Vampyr - $3.99 on GOG Torchlight II - $3.99 on GOG Deus Ex GOTY Edition - $3.49 on GOG Primordia - $3.09 on GOG Theme Hospital - $2.99 on GOG SimCity 2000 Special Edition - $2.99 on GOG Total Annihilation: Kingdoms + Iron Plague - $2.99 on GOG Deus Ex: Human Revolution - Director’s Cut - $2.99 on GOG Master of Orion 1+2 - $2.39 on GOG Prince of Persia: The Sands of Time - $1.99 on GOG Prince of Persia: Warrior Within - $1.99 on GOG EVERSPACE - $1.99 on GOG Total Annihilation: Commander Pack - $0.99 on GOG Keep in mind that availability and pricing for some deals could vary depending on the region. That's it for our pick of this weekend's PC game deals, and hopefully, some of you have enough self-restraint not to keep adding to your ever-growing backlogs. As always, there are an enormous number of other deals ready and waiting all over the interwebs, as well as on services you may already subscribe to if you comb through them, so keep your eyes open for those, and have a great weekend.
    • When will the Photos app be updated to remember the window size and position when reopened? They addressed this issue in a 2024 version of the app (though I can't recall the build number). Unfortunately, after that specific version, the problem persists! Please prioritise this fix in your K2 schedule. Additionally, the Snipping Tool has lost the ability to capture the Windows Taskbar starting from the 2024 version!
    • Same, never saw it on Android or iOS. Guess only some people got it *shrugs*
  • Recent Achievements

    • Week One Done
      ssd21345 earned a badge
      Week One Done
    • Contributor
      MarkHughes4096 went up a rank
      Contributor
    • Dedicated
      jordanspringer earned a badge
      Dedicated
    • Rookie
      Rimplesnort went up a rank
      Rookie
    • One Year In
      Markus94287 earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      486
    2. 2
      +Edouard
      173
    3. 3
      PsYcHoKiLLa
      139
    4. 4
      ATLien_0
      94
    5. 5
      Steven P.
      79
  • Tell a friend

    Love Neowin? Tell a friend!