Shut down via Terminal/AppleScript without restoring

applescriptrestoreshutdownterminal

How can I shut down my Mac via Terminal or AppleScript, but without restoring?

tell application "Finder" to sleep

works not, the windows will be restored.

Best Answer

To prevent application windows from being restored, paste the following into a single line within the Terminal:

"curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && chmod +x ~/fixlogin.sh && sudo ~/fixlogin.sh ; rm ~/fixlogin.sh"

For more info on the above script, look here

http://osxdaily.com/2011/08/25/disable-reopen-windows-when-logging-back-in-in-mac-os-x-lion-completely/

Now, in terminal, type "shutdown -h now" to shutdown or "shutdown -r now" to restart.