Write a BAT batch file start the Windows process and delay shutdown code _dos/bat

Source: Internet
Author: User
Tags goto sleep system log
A few days ago, the leader let us vote on the website to improve his ranking, but each vote only 100 votes. After a few days of leadership asked me will not do a brush ticket program, improve ranking, I said can try, study a day, finally made out, excited I did not sleep all night. Now take it out and share it.
Frankly, what I'm doing is actually a batch file, The batch extension is. bat, in fact, the polling page is just a session to control whether to vote, as we all know, the session variable will automatically disappear after IE closed, reopen the page will create a new connection, this can be repeated cast, this page is used Ajax, I find Ajax in the JS, put it's true Positive polling page to find out, the ID passed through the page, to achieve the vote. The current thing to do is to automatically open IE to connect the voting page, and then automatically disconnected, automatically connected, so as to achieve a repeat vote.
This polling site has two fatal points, one is to vote without IP control and the session server control, resulting in a repeat vote with an IP, and the actual voting process the parameters of the page is transmitted through the get way, which will lead to the possibility of cheating.
By taking advantage of the above two vulnerabilities, I did a bat batch as follows:
Copy Code code as follows:

@echo off
Echo is shutting down the redundancy process, please wait ...
taskkill/f/im Iexplore.exe
Echo-------------Program initialization complete, please indicate! ----------
Echo. & Pause
: Openie
Echo is voting, please wait a moment ...
Start "" "C:\Program files\internet Explorer\iexplore.exe"
echo IE open complete!
Ping 127.0.0.1-n 2
taskkill/f/im Iexplore.exe
Echo Delay 2 seconds to close the polls!
Goto Openie

Echo. & Pause


Key point Explanation:
taskkill/f/im Iexplore.exe forcibly shuts down the IE process and, of course, can shut down other processes, and the process name can be found through Task Manager.
Start "" "C:\Program files\internet Explorer\iexplore.exe" This is to open a Windows program, pay attention to the path, pay attention to the "" after start "" must not throw away.
Ping 127.0.0.1-n 2 With this is to delay, we all know that the bat batch delay execution too troublesome, so concise some, need to note is must ping local 127.0.0.1, otherwise may lead to remember the length of different,-N 2 means repeat two times, too about 2 seconds, Of course, when the length is adjustable, as long as the number can be adjusted.
Emphasis: The infinite loop of Bat batch processing. : Openie means to set a point, this can be arbitrary, any combination of letters are OK, do not repeat with the keyword. Goto Openie means to return the point set at the front of the Openie, set the return point must correspond before and after.

Now you can copy the above code into a text document, and make sure that you change the extension to. bat, which is the standard extension of batch processing. Of course 98 of a very classic program is Autoexec.bat believe that a lot of people have heard, interested in Baidu can be a bit. Of course, you can also give a return of three to open or end the process of other programs.
What will not be able to q himself, QQ number at the bottom right side of the page, common improvement, hehe
The following procedure is from the Internet to find, can be copied, specifically know what is doing, some places have not seen, if you have a high understanding of the words of their own research!
Hint: The following procedure is to monitor whether a process exists, if it does not exist, start, if the process is lost also started, that is, let the program run forever!
Copy Code code as follows:

@echo off
Set _task=notepad.exe
Set _svr=c:\windows\notepad.exe
Set _des=start.bat
: Checkstart
for/f "Tokens=5"%%n in (' Qprocess.exe ^| find '%_task% ') do (
If%%n==%_task% (goto checkag) Else goto STARTSVR
)
: Startsvr
Echo%time%
The Echo ******** program starts to start ********
Echo Program restarts in%time%, check system log >> Restart_service.txt
echo Start%_svr% >%_des%
Echo Exit >>%_des%
Start%_des%
Set/p=.<nul
FOR/L%%i in (1 1) do set/p a=.<nul&ping.exe/n 2 127.0.0.1>nul
Echo.
echo Wscript.Sleep wscript.arguments (0) >%tmp%\delay.vbs
cscript//b//nologo%tmp%\delay.vbs 10000
Del%_des%/q
Echo ******** Program startup complete ********
Goto Checkstart

: Checkag
The Echo%time% program works fine and continues checking after 10 seconds.
echo Wscript.Sleep wscript.arguments (0) >%tmp%\delay.vbs
cscript//b//nologo%tmp%\delay.vbs 10000
Goto Checkstart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.