Scripts for creating programs in notepad. We write programs (scripts) in Windows Notepad. Scripts are easy. Learning to write scripts

Prank viruses are simple programs that can be slipped to a friend (or enemy) to make them think that their computer has been hacked, infected with a virus, or seriously damaged. Joke viruses can be written in regular Notepad: you just need to write down commands in a file that slow down the computer and disable the work operating system or simply scare the user and then force him to run this file. Prank viruses can be anything from an annoying nuisance to a system-breaking nightmare. The "viruses" in this article are meant to be harmless pranks only, the worst thing they can do is shut down your computer. Attention: these joke viruses are intended only for computers running Windows control, they will not work on Mac OS without special training. Let's start with step 1.

Steps We write a fake virus that opens “endless” windows

Launch Notepad. Batch (.BAT) files contain commands for the computer in text form. In order to write a BAT file, you do not need a special editor - Notepad from the standard set is enough Windows programs. Notepad can be found in the Start menu or in the Accessories submenu. You can also open Notepad by pressing the Win+R key combination, type “notepad” in the text field of the dialog box that appears and press Enter.

Type "@echo off" and then, with new line, "CLS". By default, BAT files open a command prompt window and output executable commands. The "@echo off" and "CLS" commands prevent commands from appearing in the Command Prompt window, making the source of the joke invisible to the "victim".

Write commands to open many (or an infinite number) of windows. Now it's time to write a sequence of commands, executing which, your fake virus will open many windows different programs once or will tear off these windows endlessly. It's important to know that if you open too many windows endlessly, your computer may eventually freeze. Read on to learn how to make both types of “virus”:

  • To open a certain number of windows, type the following command in Notepad on a new line: start (program name). Instead of the phrase in brackets, enter the name of the program on the “victim’s” computer or or the full name of the executable file. This command instructs the computer to open a specified program window. For example, start iexplore.exe will open a window Internet Explorer. Repeat the "start" command as many times as you want, and your "virus" will open the window as many times as you specify. Here are a few programs that can be entered after the “start” command:
    • iexplore.exe - Internet Explorer browser
    • calc.exe - Calculator
    • notepad.exe - Notepad
    • winword.exe - Microsoft Word
  • To open an infinite number of windows, first type :A on a new line, including the colon. On the next line, type start iexplore.exe (or other program). Finally, on the line below, type goto A . This sequence of commands will cause the computer to open an Internet Explorer (or any other program) window, return to the location just before the window opened, and then immediately open a new window until the Command Prompt window is closed or the computer freezes.
  • Write a message in the “virus”. For a frightening effect, you can add a message to the “virus” that will make the user think that something is wrong with his computer. To display a message, start a new line and type echo Your message. Then, on a new line, type pause . The "pause" command will stop the execution of the "virus" after the message appears.

    • To make your joke believable, write a message similar to real error messages, for example: Fatal error. The C:// directory is corrupted.
  • Save the text as a batch file. When you're done, from the Notepad menu choose File > Save As... and then specify the file extension ".bat" (for example, "pinball.bat"). From the File Type drop-down list, select All Files. Save the file somewhere on the “victim’s” computer.

    Force the user to open the file. For your joke to work, you need to get the “victim” to start it. This can be achieved different ways. One of the ones that works is to create a shortcut to your batch file and change its icon to something the user actually uses, then change the name of the shortcut to match the icon. Sit back and watch the results from the comfort of your seat!

    How to write a .VBS with a bug or hack message

    Launch Notepad. As in the previous joke, this one requires you to write several simple commands. However, this time the effect will be different - instead of opening windows, this joke creates several error messages that will make the user think that there is an error in their operating system or that the computer has been hacked.

    Type "x=msgbox("MessageText", 5+16, "MessageTitle") exactly as specified here, including brackets and quotes, and replace "MessageText" and "MessageTitle" with the desired text. This command opens the standard dialog window Windows errors with the error message and window title you specified. To make your joke believable, use real-life messages and headlines. For example, try "Terminal Error" as the title, and "A critical problem has been detected in the directory C://Users/Windows/system32" as the message.

    • You might want to take your joke further in the hacking direction. In this case, use messages like: “I have full access to your system. Prepare to be hacked." Nothing like that will actually happen, so it will only work with people who are not good with computers.
    • The expression “5+16” tells the computer to create a dialog box with a critical error icon and two buttons, “Retry” and “Cancel.” By changing these numbers, you can get different types windows with errors. Simply substitute any one-digit number for 5 and any two-digit number for 16 from the numbers below:
      • 0 (OK button)
      • 1 (OK and Cancel buttons)
      • 2 (Cancel, Redo and Skip buttons)
      • 3 (Yes, No, and Cancel buttons)
      • 4 (Yes and No buttons)
      • 5 (Redo and Cancel buttons)
      • 16 (Critical error icon)
      • 32 (Help icon)
      • 48 (Warning icon)
      • 64 (Information icon)
  • Repeat the error message as often as you like. Repeat the commands above as many times as you wish with any error messages. Messages will appear one after another, that is, as soon as the user closes one message, another will open. You can use this fact to create a longer message that is increasingly urgent.

    Save the document as a file Visual Basic(VBA). Once you have entered all the desired messages, save the file. From the Notepad menu, select File > Save As..., give your file a name with the extension ".vba". Be sure to select "All Files" from the "File Type" drop-down list. Now, for the joke to succeed, you need to force the “victim” to run this file, for example using the trick from method 1.

    Using a pre-written batch file

    Launch Notepad. This prank uses Notepad commands to force the computer to open programs randomly until the batch file is disabled or the computer freezes. To make this prank you just need to copy and paste the commands given in this section. However, note that this will not work on all computers.

    Copy and paste the following commands: @echo offclsbegingoto %random%:1start cmd.exegoto begin:2start mspaint.exegoto begin:3start pinball.exegoto begin:4start iexplore.exegoto begin:5start explorer.exegoto begin:6start solitaire.exegoto begin:7start explorer.exegoto begin:8start edit.exegoto begin:9start iexplore.exegoto begin:0start mspaint.exegoto begin

  • Change these commands to suit your needs. This code randomly opens programs listed after the word "start" indefinitely. You may have noticed that some programs are repeated. Change the list of programs as you wish.

    • Please note that some of the names of the programs listed above may not be correct on some machines, for example, some computers may not have "pinball.exe". You should double check that the program names are correct before moving the joke virus onto the “victim” computer.
    • If you are in doubt about the name of a particular program, remember that the exact program path is also fine. For example, instead of “iexplore.exe” you can write “C:\Program Files\Internet Explorer”.
  • Save the text as a batch file and run it (if you dare). Save the file with a ".bat" extension by selecting "All Files" from the "File Type" drop-down list. When you manage to get the user to launch it, he will start randomly opening programs on the computer without stopping.

    • To make it more fun, try replacing “*.exe” in one of the commands with the full path to a user document. For example, "start C:\Documents\123.doc" will open document 123.doc from the Documents folder in the default editor, and
      edit (full filename)
      goto begin
      will open specified file V text editor DOS. It will look like the hacker is reading personal documents. Remember that filenames containing spaces must be enclosed in quotes!
  • Website Notepad is a simple PHP and JQuery application that allows users to write notes. All entries will be saved to text files on the server.

    Step 1. HTML
    First, let's look at the markup. To do this, let's create a regular HTML5 document. Below is only the important part, the rest of the code can be found in the source file index.php.

    The note

    As you noticed, the markup is not complicated, of course, we will add CSS styles, let's connect jQuery and our script script.js. Note that the phpecho expression is in the textarea.

    Step 2: CSS
    To create a background in the form of a piece of paper for notes, use the pseudo-element:after. When you resize the text input area in jQuery code, the bottom portion automatically moves down.

    #pad( position:relative; width: 374px; margin: 180px auto 40px; ) #note( font: normal 15px "Courgette", cursive; line-height: 17px; color:#444; background: url("../ img/mid.png") repeat-y; display: block; border: none; width: 329px; min-height: 170px; overflow: hidden; resize: none; outline: 0px; padding: 0 10px 0 35px; ) # pad h2( background: url("../img/header.png") no-repeat; overflow: hidden; text-indent: -9999px; height: 69px; position: relative; ) #pad:after( position:absolute ; content:""; background:url("../img/footer.png") no-repeat; height:40px;

    Step 3: PHP
    The PHP code for our example is quite simple. The contents of the note are read and output when the page is loaded, and when jQuery sends an AJAX request, we write the contents to a file. The recording file will be overwritten.

    $note_name = "note.txt"; $uniqueNotePerIP = true; if($uniqueNotePerIP)( // Use the user's IP address to name the note file. // This technique is useful in cases where the application // is used by multiple users at the same time. if(isset($_SERVER["HTTP_X_FORWARDED_FOR"]))( $note_name = "notes/".$_SERVER["HTTP_X_FORWARDED_FOR"].".txt"; ) else( $note_name = "notes/".$_SERVER["REMOTE_ADDR"]..txt"; ) ) if(isset($ _SERVER["HTTP_X_REQUESTED_WITH"]))( // AJAX request if(isset($_POST["note"]))( // Write the file to disk file_put_contents($note_name, $_POST["note"]); echo "( "saved":1)"; ) exit; ) $note_content = ""; if(file_exists($note_name))( $note_content = htmlspecialchars(file_get_contents($note_name)); )

    You should pay attention to the $uniqueNotePerIP variable. If it is true, each user will have a unique note file named based on the IP address. If false, everyone will use the same file.

    Step 4: jQuery
    jQuery working in this application consists of tracking changes in the text input area and sending an AJAX post request to index.php where the text will be written to a file.

    $(function())( var note = $("#note"); var saveTimer, lineHeight = parseInt(note.css("line-height")), minHeight = parseInt(note.css("min-height") ), lastHeight = minHeight, newHeight = 0, newLines = 0; var countLinesRegex = new RegExp("n","g"); // The input event is triggered by keypresses, // copy, and even undo/redo operations. ("input",function(e)( // Clearing the timer prevents // each keystroke from being saved clearTimeout(saveTimer); saveTimer = setTimeout(ajaxSaveNote, 2000); // Count the number of new lines newLines = note.val().match (countLinesRegex); if(!newLines)( newLines = ; ) // Increase the height of the note (if necessary) newHeight = Math.max((newLines.length + 1)*lineHeight, minHeight); // Increase/decrease the height only one times when changing if(newHeight != lastHeight)( note.height(newHeight); lastHeight = newHeight; ) )).trigger("input"); // This line will change the size of the note when the page loads function ajaxSaveNote())( / / Run an AJAX POST request to save the post $.post("index.php", ( "note" : note.val() )); ) ));

    The usual approach in such cases is to bind a handler to the keypress event. But sometimes this method is not enough, since the user can simply copy the text into the input area, or select a suggestion from the browser's automatic corrector, or use the undo/redo operation.

    That's all. Ready!

    How to write scripts for an operating system, websites, or just games? The answer to this, believe me, is an easy question and will be discussed within the framework of this article.

    general information

    It is highly desirable to have at least minimal knowledge of programming. But if something seems incomprehensible, then an article or two will help fill the gap. First, let's define what a script is. This is the name of an algorithm written in certain programming languages ​​that is stored on a person’s computer and can interact with certain files, programs such as browsers and system settings. All this allows you to significantly complement standard features, create automated assistants that will take on part of the work.

    Let's start working with browsers

    This is perhaps one of the easiest activities. If we write scripts in JavaScript, then an ordinary notepad and knowledge of this programming language are enough. True, there are also disadvantages here. So, every person who has the same Notepad will be able to see what the script is. And if he has bad intentions, and there is a vulnerability in the code, then problems may arise. Answering the question about how to learn to write scripts in JavaScript, it should be noted that for this it is enough to study given language programming. In order to create better and more complex programs, you can use various libraries. But they require appropriate web browser extensions. And when changing computer equipment will have to be carried out additional settings. And when using third-party developments, you need to make sure that the script will not send user data to third-party services. It should be noted that each browser has its own specific limitations. But in general, you can do almost anything with their help. Why are they written in such cases? They are needed when human activities need to be automated.

    We work with the Windows operating system

    Let's say we need to change the computer configuration. For this there is a wide range of graphic tools, but, alas, they do not cover everything. Therefore, it is often necessary to create system scripts. They have the extension .bat. Every person who works at a computer for more or less a long time has already encountered such files. But how to write scripts for Windows? For this we will need the same Notepad. First we create a new one text file. It is necessary to record system commands in it. After this, you need to change the file extension to .bat. And all that remains is to launch this development. If everything is correct, then the commands will be executed successfully, as you can see. But in case of errors or illiterate code writing, at best, nothing will happen. Therefore, it is better to understand what you are writing down. Simply taking code from somewhere and thoughtlessly inserting it is absolutely not recommended! This can lead to significant problems with the operating system. And you’ll be lucky if such dangerous actions were done from a guest account. After all, a command from an administrator can turn a computer into a “brick.”

    What about Linux?

    It should be remembered that Windows is not the only operating system. There is also Linux, which is quite popular. How to write scripts in this operating system? They are created using a shell - a special command interpreter, which is the interface between a person and the operating system kernel. In Linux, scripts are essentially just a file that lists system commands. It's simple and convenient at the same time. But the shell needs to know how such a file should be processed. By default it just reads. And if you need to execute, then the “#!” construction is used, which must be placed before the command. All scripts have the extension .sh. It should be noted that with their help you can do quite a lot of complex things. For example, backup files. In general, there are extremely many use cases.

    Learning to write scripts

    So, first we need to decide on the environment where we will type the code. Almost always, one Notepad is enough for this. But it is not very convenient to display the structure of structures; moreover, operators and other elements are not highlighted. Therefore, as a worthy alternative we can offer Notepad program++. For those who know English language, it’s not so difficult to translate that this is also “Notepad”. But with expanded capabilities. This small but very nice development is aimed primarily at programmers. In it you can enable the display setting of almost everything that is available. There is a convenient code display tool and many other, albeit small, but nice little things that will make the writing process more comfortable. In general, the question “where to write scripts” has received many different answers, each of which offers its own twist. There are also very sophisticated environments, with emulators and many debugging tools. Choose what your heart desires. After this, you need to take care of your knowledge. Help on the programming language or operating system commands is suitable as a basis. For more advanced study, you can read several books that explain the features of machine logic and code processing.

    Real-time training services

    If you are interested in learning how to write scripts, then you should not discount the possibility of learning with the help of information educational technologies. What does such a “programmer forge” look like? According to the program, compiled according to the opinion of experienced developers, a beginner is led from the easiest to the most difficult moments. So, dynamic data updating can initially be studied in order to subsequently move on to creating socket servers. And the person undergoes training slowly, step by step, absorbing the maximum amount of data. Therefore, if difficulties arise, you can turn to them for help. It’s not a fact that the first one you come across will satisfy all your needs, but then you’ll just have to try something different.

    Why study?

    Many people are interested in how to write scripts for games. Well, this is not very difficult, but it is not the only use of such a feature. But let's look at the game as an example. Let’s say a person likes to play some kind of entertainment on a certain website. But, alas, it stipulates that it is necessary either to invest your money, or to carry out certain actions for a long time and monotonously. And if the second path was chosen, then scripts are exactly what is needed here. This can also be used in stationary games on a computer. There are characters under control artificial intelligence, and in order to fight with him, you can create your own version of AI, thus arranging a battle between the computer and itself (and for easier passage). But scripts can be successfully used not only in games. Let's say that there is a website of a serious company. An important aspect is maximum support for communication with clients. And for this, a small form is added in the form of a script, with which you can get expert advice online. There are many possible uses!

    Conclusion

    Alas, it is very difficult to convey within the framework of this article how to write scripts correctly. You can, of course, use general phrases about how the code should take up less space, be optimal, and much more, but you can really understand this only in practice. After all, only experience and search optimal solutions can help implement programs in such a way that they fulfill their “responsibilities” with minimal effort. In programming in general, and not just in writing scripts, a lot depends on practice! Therefore, you need to constantly learn, improve and think about how to implement the task in the best possible way.

    The modern Internet is unthinkable without scripts. Learning to write in JavaScript.

    If the Bible were written for the Internet, it would begin like this:

    First there was mail. And the engineers saw that this was good. And they created WWW with hyperlinks. And the engineers saw that this was also good. And then they created the JavaScript language to bring pages to life.

    This is roughly what happened in reality. JavaScript invented to “revive” HTML. Scripts JavaScript written directly into the text HTML or stored in separate files, like styles CSS. They are executed immediately after the page is loaded into the browser.

    Even the language itself was at first called LiveScript. Then it was renamed to JavaScript, because they planned to somehow link it with the general-purpose Java language. But now they have practically nothing in common, and JavaScript- a completely independent programming language with its own clear specification ECMAScript.

    Technically, JavaScript is a trademark of Oracle, and the language is an “extension” of ECMAScript, along with Microsoft's JScript and ActionScript, but that's more of a trade mark issue. The main thing is that free ECMAScript does not belong to anyone.

    Over time, sphere of influence JavaScript has expanded significantly. They began to use it not only for scripts on the page HTML, but also for serious large web applications and entire programs that run in the browser. There are tools to “package” these programs in a special way and run them separately from the browser. These are compilers and interpreters, which are discussed in more detail in the training courses "" and "".

    JavaScript applications run in any environment that has an appropriate interpreter.

    For now, we are only interested in browsers and HTML pages.

    How to do JavaScript? Writing a basic script is no more difficult than writing a simple HTML- a page, because scripts JavaScript are written in plain text, that is, they can be created literally in the same Notepad, then saved in separate files or pasted into the body HTML-document. The simplest things on JavaScript are really easy to do.

    How to Write JavaScript

    For example, let's make a simple script for the Windows script server to execute. This script can be written directly in Notepad and executed without a browser.

    WScript. echo(" Hello Skillbox!")

    We write this text in "Notepad", then save the file under the name skillbox.js and run in "Explorer" Windows.

    A similar script can be written directly in the page code HTML between tags And . There you can already use regular JavaScript methods, not a method echo specific object WScript. Let's look at some of the standard methods for input and output of data in the browser.

    alert()

    Method alert() displays a window with an “OK” button. The window displays a message indicated in parentheses. For example, “Hello, Skillbox!”. That is, in this case, the browser does exactly the same thing that the script server did before Windows.

    These examples can also be written in Notepad, just saved in files with the extension HTML. For example, skillbox.htm.



    alert(" Hello Skillbox")

    Result:

    As an argument alert() You can specify not only specific text, but also the result of any calculations or processing of other data. For example, alert(x), where x is calculated separately.

    confirm()

    Method confirm() displays the same window with a message, but with two buttons - “OK” and “Cancel”. Depending on which button the user clicks, the method returns either true, or false. The server receives this return value from the user and performs some action depending on the response.

    The syntax is the same, only here a choice is logically assumed, so the user is asked a question.



    confirm(" Hello Skillbox")

    Result:

    prompt()

    Method prompt() displays a message dialog box and text field, where the user enters data. There are also two buttons “OK” and “Cancel”. When the first button is pressed, the method returns the entered text to the server, and when the second button is pressed, it returns a Boolean value false.

    The syntax here is:

    prompt( message, data_input_field_value)

    The input field value is optional. There you can enter the text that was originally entered into the field for the convenience of the user.



    prompt(" Say hi to Skillbox", "Hello")

    Result:

    Possibilities of modern JavaScript go far beyond primitive data input and output through forms. We have presented these methods only as the most simple examples. Besides, JavaScript allows you to respond to user actions. For example, on mouse movements or pressing certain keys. JavaScript often used to provide asynchronous operation ( Technology AJAX) when information on a page is updated without reloading it. In this mode, data is sent to the server and downloaded from there interactively. Besides, JavaScript able to manipulate HTML-elements on the page (create and hide tags, etc.) and do much more.

    Useful Tools Developer Console

    All popular browsers have a special developer console. It shows the script code on the page and also displays another useful information. IN Chrome, Firefox And I.E. developer console opens when clicked hotkey F12, V Safari - Ctrl+Shift+I or Ctrl+Alt+C. In the screenshot, the scripts are displayed at the top right, along with other elements of the web page.

    Chrome Developer Console.

    Code editors

    In the future, for convenient programming, you will need to install a code editor or IDE (Integrated Development Environment), integrated development environment. IDE is an editor with advanced functionality that is integrated with other useful tools, supports connecting additional modules, and so on.

    In this topic I will teach you how to create scripts to amuse your haters =)
    So, to create scripts we need a regular notepad and crooked hands
    1 script. Your system is infected with a virus!
    This script, after running, displays a message on the screen stating that your system is infected and asks you to restart your computer, and then launches a lot of command lines, calculators, notepads and much more.
    Open notepad and paste the following code there:

    On error resume next
    set t=createobject("Wscript.Shell") set kill = createobject("wscript.shell") kill.run"taskkill /f /im explorer.exe",0
    msgbox"System problem",16,"Error" msgbox"You are infected with a virus",48,"Windows" msgbox"The system needs to be restarted",16,"Windows"t.run"help" t.run"help" t.run "help" t.run"help" t.run"calc.exe"t.run"notepad.exe" t.run"telnet" t.run"help"t.run"explorer" t.run"help" t .run"help" t.run"help" t.run"help"t.run"help" t.run"help" t.run"calc.exe" t.run"notepad.exe" t.run"telnet "t.run"help" t.run"help" msgbox"System failure",16,"Windows" t.run"help" t.run"help" t.run"help"t.run"help" t. run"help" t.run"help"t.run"help"t.run"calc.exe" t.run"notepad.exe" t.run"telnet" t.run"help" t.run"explorer" t.run"help" t.run"help" t.run"help"t.run"help"t.run"help" t.run"help" t.run"calc.exe" t.run"notepad. exe" t.run"telnet" t.run"help" t.run"help"msgbox"System failure",16,"Windows"t.run"help" t.run"help" t.run"help"t .run"help" t.run"help" t.run"help"t.run"help" t.run"calc.exe" t.run"notepad.exe" t.run"telnet"t.run"help " t.run"explorer" t.run"help" t.run"help"t.run"help" t.run"help" t.run"help" t.run"help" t.run"calc.exe " t.run"notepad.exe"t.run"telnet" t.run"help"t.run"help" msgbox"System failure",16,"Windows" t.run"help" t.run"help" t.run"help"
    We save it all with the extension .vbs

    2 script. Infinitely beeping speaker =)
    Makes you squeak endlessly system speaker in the computer processor
    Open Notepad again and paste the following code into it:

    Set S = CreateObject("Wscript.Shell")
    do execute"S.Run ""%comspec% /c "" & Chr(7), 0,True" loop
    3 script. Flashing keyboard
    Makes the lights on the keyboard blink, and also makes the written text look like: EXAMPLE OF TEXT
    PHP:
    Set s = CreateObject("Wscript.Shell")
    do wscript.sleep 80


    wscript.sleep 80
    s.sendkeys"(numlock)" wscript.sleep 80
    s.sendkeys"(capslock)" wscript.sleep 80
    s.sendkeys"(scrolllock)" wscript.sleep 80
    s.sendkeys"(scrolllock)" wscript.sleep 80
    s.sendkeys"(capslock)" wscript.sleep 80
    s.sendkeys"(numlock)" wscript.sleep 80
    wscript.sleep 80
    s.sendkeys"(scrolllock)" wscript.sleep 80
    s.sendkeys"(capslock)" wscript.sleep 80
    s.sendkeys"(numlock)" wscript.sleep 80
    s.sendkeys"(numlock)" wscript.sleep 80
    s.sendkeys"(capslock)" wscript.sleep 80
    s.sendkeys"(scrolllock)" wscript.sleep 80
    loop

    4 script. Automatic drive in and out =)
    Causes the disk drive in the computer to move in and out endlessly

    Set WMPlayer = CreateObject("WMPlayer.OCX.7")
    doWMPlayer.CdRomCollection.Item(0).Eject() loop
    Thank you all for your attention!
    P.s. To close the script, you need to end the corresponding process in the task manager!