This is the 17th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

Basic VBS Syntax

CMD Basic commands

PS

✌ means or

HelloWorld

The first program

Let’s make a HelloWorld box

  1. Desktop 🖱️ right-click -> New text document

  2. Example Change the input method to English

  3. Open the new text document and enter the following

    msgbox("Hello,World!" )Copy the code
  4. Click on top left file -> click save ✌ + S

  5. Right-click on the file -> click to rename ✌ F2-> change to 01-Helloworld.vbs

  6. Click Run to pop up a pop-up box with the content of HelloWorld.

  7. Change the window location: Win + ⬅️ to facilitate program debugging.

Extension not displayed?

  1. According to theWin + EOpen theFile explorer
  2. Click on the menu barTo view
  3. Tick the rightFile extension

What is the extension

It’s just a collection of letters that, when you change the extension, become a runnable program?

  • Why an extension?

Without reading the contents of the file, the system cannot know which software the file needs to be opened.

The Chinese language

  1. Right click edit -> Modify content to Chinese

    Msgbox (" Hello world! )Copy the code
  2. Run detects ✌ chaos

  3. Baidu searched for a solution

VBS grammar

cycle

How to prank the user so that he can not close this window?

Scripting language code is executed line by line,

Execute the next line of code after each turn off.

'Write an infinite number of msgboxes msgbox(" Hello world! "Hello world! )...Copy the code

Is there an easier way?

'This is a line of comment, used as its name suggests, and the computer will not execute this line. 'The future of programming will use it a lot do Msgbox (" Turn it off? You're thinking Peach") loopCopy the code

How to shut down

  1. ✌ press taskbar right mouse buttonCtrl + Alt + Del
  2. chooseTask manager
  3. findMicroSoft ®...And the selected
  4. Click on the bottom right cornerEnd task✌ Restart computer

Condition of circulation

A window for counting down 10 numbers

Determine whether the conditions are met before each run

'Define a variable called I and the value is 10 dim I' why don't I enclose numbers? Do while I >0 msgbox(I) I = I -1 loop '= equal to' <> not equal to '> > greater than' < less than 'Copy the code

conditional

Join spoof user interaction

Determines whether to run based on conditions

If answer = "I am a pig" then msgbox(" I am a pig ") Elseif answer = "I'm a pig" then MSgbox ("hahaha, you are a pig") else do msgbox(" You're thinking Peach") loop end ifCopy the code

These are the three most commonly used expressions in programming

More?

Make a spoof program that does damage

Produce an instance of the class and invoke the methods in the instance

The programming language already does that for you, and all we have to do is decide what to use it for.

This will make sense in the future when you can write your own classes.

If answer = "I am a pig" then msgbox(" ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha Elseif answer = "I'm a pig" then msgbox("hahaha, You are a pig") else 'use set to create an instance that can be called' Car = manufacture (drawing) set ws = createObject (" wscript.shell ") 'car. Ws. run("cmd.exe /c shutdown -s -t 10") msgbox("10 seconds later shutdown ") end ifCopy the code

Recommended reading

VBS+ BAT code for prank

VBS- Basic syntax collation