REM Creates Shortcut with a Path to the desktop.
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
REM Establishes and names the shortcut Shutdown.
Set linkShutdown = Shell.CreateShortcut(DesktopPath & "\Shutdown.lnk")
REM Adds shutdown code to the shortcut.
linkShutdown.Arguments = "-s -t 01"
REM Adds Description to shortcut that displays message on link over.
linkShutdown.Description = "Shutdown this Computer"
REM Creates Icon for shortcut using system shutdown icon.
linkShutdown.IconLocation = ("%SystemRoot%\system32\SHELL32.dll,27")
REM Retrieves shutdown target path for shortcut.
linkShutdown.TargetPath = "shutdown"
REM Saves the Script.
linkShutdown.Save
REM Prompts the user if they want to shutdown their computer,
REM displays ok and cancel buttons for the user to choose.
Set shellApp = CreateObject("Shell.Application")
answer = MsgBox("Do you really want to shut down the computer?", 1,"Turn off Computer
Script!")
If answer = 1 then
Initiate_Logoff()
End if
REM Function that shuts computer down.
Function Initiate_Logoff()
REM Adds shutdown code to the shortcut.
End If
End Function
- Edited by Namemybullets 2 minutes ago Fixed