Script code of Emule automatic shutdown implemented by vbs

Source: Internet
Author: User

Set FSO = Createobject ("scripting. FileSystemObject ")
Set Ws = wscript. Createobject ("wscript. Shell ")
Count = 0
Do until count <-1
Chksize = FSO. getfolder ("C: \ Program Files \ eMule \ Temp"). Size
If chksize = 0 then
Wscript. Sleep 120000
The sentence 'ws. Run "shutdown-P", 0' is not very good.
WS. Run "tsshutdn 60/delay: 0/powerdown", 0' this is shutdown in a batch Program As shown in, it is very strong. I tried it many times and shut down the server in various cases (2003 system, not tested by other systems)
End if
Wscript. Sleep 120000
Loop

Replace the aboveCodeSave it as a text file, change "C: \ Program Files \ eMule \ Temp" to your own temporary eMule file directory, and change the suffix to vbs.
This script is used to detect the temp folder every two minutes. If the Emule download is complete, the temp is empty. The script waits for two minutes and forcibly closes the local computer without timeout or warning.

However, I am very impressed with the author's opinions. The author is too talented to come up with this method.

I am very grateful for my comments. The author's anger is understandable and I will not explain it much because I don't see it on your website, I have read your code and can work properly.

Now let's talk about my point of view:
1. What I see on the Internet is that the prompt is in do, so this method is not feasible.
2. I don't know much about the shutdown parameter. The system I use is 2003 + SP2 and the shutdown has the-P attribute, but I have read yourArticleNow you know, there is also a-f attribute, and I also have this version, so your code is more universal.
3. As for the script, it takes 2 seconds to forcibly shut down the local computer without timeout or warning. This is my carelessness (it should be 2 minutes 120000 = 120*1000). This article will correct it.

The author's attention to his articles is admirable,
In addition, you cannot leave a message on your website. If you try a lot, you can try it or add a contact to your website to contact you.

Paste the original author code:
Strong General information

Dir = "E: \ Temp"
Set FSO = Createobject ("scripting. FileSystemObject ")
Cmd = "shutdown-S-F-T 60 ″
Set Ws = wscript. Createobject ("wscript. Shell ")
Wscript. Echo "The eMule automatic shutdown script has been run ......"
Count = 0
Do until count <-1
Chksize = FSO. getfolder (DIR). Size
If chksize = 0 then
WS. Run cmd, 0
End if
Wscript. Sleep 120000
Loop, because many people do not set the path for storing files

Dir = "C: \ Program Files \ eMule \ Temp"
Set FSO = Createobject ("scripting. FileSystemObject ")
Cmd = "shutdown-S-F-T 60"
Set Ws = wscript. Createobject ("wscript. Shell ")
Wscript. Echo "The eMule automatic shutdown script has been run ...... "
Count = 0
Do until count <-1
Chksize = FSO. getfolder (DIR). Size
If chksize = 0 then
WS. Run cmd, 0
End if
Wscript. Sleep 120000
Modified by Loop itself:

set FSO = Createobject ("scripting. fileSystemObject ")
set Ws = wscript. createobject ("wscript. shell ")
COUNT = 0
do until count <-1
chksize = FSO. getfolder ("C: \ Program Files \ eMule \ Temp "). size
If chksize = 0 then
wscript. sleep 120000
ws. run "tsshutdn 60/delay: 0/powerdown", 0' this is seen in a batch Shutdown program, very strong, tried many times, can be shut down in various cases (2003 system, not tested by other systems)
end if
wscript. sleep 120000
loop

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.