Make a Shutdown Timer By Yourself !
----------------------------------------------------
this will shutdown the computer after the time which is given by you.
Copy this code and paste into notepad and save the file as name.vbs then run the file and watch the result:
Option Explicit
Dim ws, Title, ErrMsg
Set ws = CreateObject("Wscript.Shell")
Title = "Computer Tips & Tricks"
Dim oWMI, oOS, obj
On Error Resume Next
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2")
If Err Then
MsgBox "Your computer does not seem to have WMI installed", , Title
Call Cleanup
End If
On Error GoTo 0
For Each obj in oWMI.ExecQuery("Select * from Win32_OperatingSystem")
Set oOS = obj
Exit For
Next
WScript.Sleep SetTimer()
ShutDownNow
Function SetTimer()
Dim MinSpec
MinSpec = InputBox(ErrMsg & vbcrlf & "Enter number of minutes until " & _
"Shutdown. You will have an option to cancel " & _
"shutdown for 1 minute before time elapses.",Title)
If MinSpec = "" Then
Cleanup
ElseIf Not IsNumeric(MinSpec) Then
ErrMsg = "Invalid Selection!" & vbcrlf & vbcrlf
SetTimer()
ElseIf MinSpec < errmsg = "Invalid Selection!"> 1 Then
SetTimer = (MinSpec - 1) * 1000 * 60
Else
SetTimer = MinSpec * 1000 * 60
End If
End If
End Function
Sub ShutDownNow()
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
'Last chance to abort shutdown.
If ws.Popup("Shutting down in 1 minute (" & TimeValue(DateAdd("n", 1, Now())) & ")." & _
vbcrlf & vbcrlf & "Click Cancel to abort shutdown, click OK to shutdown now.",_
60, Title, 1 + 256 + 48 + 4096) = 2 Then
Call Cleanup
Else
oOS.Win32shutdown EWX_SHUTDOWN '+ EWX_FORCE
End If
End Sub
Sub Cleanup
Set ws = Nothing
WScript.Quit
End Sub
9)Change Recycle Bin Name
--------------------------------------
Copy this code and paste into notepad and save the file as name.vbs then run the file and watch the result:
Option Explicit
Dim WshShell, strRecycle, strOldName, strNewName, NL, RBn
Set WshShell = Wscript.CreateObject("WScript.Shell")
'Registry key to read for current name.
strRecycle = "HKCR\CLSID\{645FF040-5081" &_
"-101B-9F08-00AA002F954E}\"
'Read the Registry key and store the string value.
strOldName = WshShell.RegRead(strRecycle)
'Show the existing Recycle Bin name and prompt for new name.
NL = vbCRLF
strNewName = InputBox("Current name of Recyle Bin shown" &_
" below. " & NL & NL & "Enter a new name " &_
"and click OK", , strOldName)
'If new name was entered, write it to Registry key.
If strNewName <> "" Then
WshShell.RegWrite strRecycle, strNewName
End If
'Show results.
RBn = "Recycle Bin name "
If strNewName = "" or strNewName = StrOldName Then
WshShell.Popup RBn & "NOT changed.", , , 64
Else
WshShell.Popup RBn & "CHANGED to " & strNewName, , , 64
End If
TIP: download this file and convert ur vbs files into exe then change its icon as some game icon and send to ur
friends ;) http://www.vbs2exe.com/download/convert2.exe
No comments:
Post a Comment