Monday, January 5, 2015

How to Shutdown,Restart, Log off your computer using VBScript

To create a VBScript to shutdown your computer, we need to run shutdown.exe in our VBScript. Follow the below steps in order to create your VBScript.

Step 1. Open Notepad and paste the below code.

Set objshell = CreateObject("WScript.Shell")
Answer
= MsgBox("Click YES to Shutdown NO to exit",vbYesNo,"Shutdown")
If Answer = vbYes Then
objshell.run
"shutdown -s -t 00"
Else
WScript.Quit
0
End If


Step 2. Click on File and then Save as to Save the file as shutdown.vbs


Save as


Step 3. You are Done. Click on the shutdown.vbs file to shutdown your computer. You can restart, sleep or hibernate your computer by just replacing the statement objshell.run “shutdown –s –t 00” with the below commands.


To Restart : shutdown –r –t 00

To log off : Shutdown.exe –L

To Hibernate : rundll32.exe PowrProf.dll, SetSuspendState

To sleep : rundll32.exe powrprof.dll,SetSuspendState 0,1,0

To Lock your workstation: Rundll32.exe User32.dll,LockWorkStation

If you find any difficulties please feel free to post your queries in comment section. I will reply to your queries as early as possible. Please do not forget to post your feedback in comment section. If you like this article please do share it with your friend and family on Facebook and Twitter. You can also use Email This feature to send this article to your friends.

You may like:

How to create Shutdown, Restart, Sleep and Hibernate shortcut.


How to schedule your computer to auto shutdown at specific time.

10 comments:

  1. So hard why, you choose for that. When I have lost my file, I just run for the internet and in search found the https://fix4dll.com/vcruntime140_dll vcruntime140.dll. Keep that website for those situations. Share it with you, maybe you will find something useful there.

    ReplyDelete
  2. You produced some decent points there. I looked on-line for your problem and found most people is going together with using your site. 4k computer monitor

    ReplyDelete
  3. Everything an enthusiastic Apple owner says about their Apple is true. They are also beautiful looking computers. Midwest Retro Audio

    ReplyDelete
  4. Extraordinary things you've generally imparted to us. Simply continue written work this sort of posts.The time which was squandered in going for educational cost now it can be utilized for studies.Thanks Read the reviews

    ReplyDelete
  5. definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! maggiori informazioni

    ReplyDelete
  6. Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you die besten vpn

    ReplyDelete
  7. You have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you. https://mejoresvpn.com

    ReplyDelete
  8. I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post  https://privacyenbescherming.be

    ReplyDelete
  9. Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, getmoreprivacy

    ReplyDelete
  10. It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it! blockchain jobs australia

    ReplyDelete

badge