how to write simple scripts

Discussion in 'Web Design & Coding' started by muzikool, Apr 10, 2004.

  1. muzikool

    muzikool Act your wage. Political User

    I've never written a script before and I need to make a few simple ones: one to logoff, one to shutdown, and one to reboot. I know that the command line arguments are -l, -s, and -r. I just don't know how to put those in a script.
     
  2. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    shutdown -s -t 0

    that will shutdown the system in 0 seconds.

    shutdown -r -t 0

    that will restart the system in 0 seconds

    shutdown -l -t 0

    yeah.
     
  3. muzikool

    muzikool Act your wage. Political User

    They worked, thanks! :D
     
  4. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    rundll32.exe user32.dll,LockWorkStation

    ^lock the workstation
     
  5. chaos945

    chaos945 Moderator

    Messages:
    934
    (from command prompt)

    shutdown /?

    Will give you a list of all possible switches and their descriptions.
     
  6. ignipotentis

    ignipotentis OSNN Addict

    Messages:
    127
    shudder
     
  7. khs

    khs OSNN Junior Addict

    Messages:
    10
    how do i put the commands into a .vbs script? i am trying to follow muzikool's example for putting together a samurize config. i've linked my buttons to a script with the shutdown command, but i get an error, "expected end of statement". what needs to be added, a simple "end"? thanks
     
  8. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    what's your script look like now?
     
  9. khs

    khs OSNN Junior Addict

    Messages:
    10
    its what i got from muzikools config -
    shutdown -s -t 0
     
  10. cpugeniusmv

    cpugeniusmv Computer Genius

    Messages:
    485
    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    WshShell.Run("shutdown -s -t 0")