Jump to content
Sign in to follow this  
Zibl

Shortcut Shutdowns :wall:

Recommended Posts

Believe it or not, I've spent the last 20 minutes Google searching this subject... only to find not-so-much information on it. I'm using Windows 7 (if that matters) and I'm trying to set up a timed shutdown of my computer. It's a long story as to why, so I won't get in to that, but the point is: I'm getting frustrated with myself. I've done it in the past, but it doesn't seem like it's working for me with my recent purchase of a new computer :wall: . Here's an example of what I'm tried doing:

 

- At the Desktop, right click >> New >> Shortcut

- In the item location, I'm looking to type something along the line of "shutdown -s -f -t 3600 -c Windows will shutdown in 60 minutes!"

- If I remember correctly, -s is "Shutdown", -f is "forcing applications to close without warning", -t is "setting a time in seconds until the shutdown", and -c is "a message box with the typed text"

 

When I click the finished shortcut, I get a very quick pop-up that I can't even read. And it isn't the message box type of pop-up like it should be; it's one of those DOS windows that insta-disappears. I have a tendency of over complicating very simple things & over looking very simple mistakes, especially when I get frustrated over something I technically KNEW how to do :mellow: . Any help is appreciated!

 

P.S. - I know that there's probably an easier way to do this (i.e. a pre-installed program on my computer), but I'd rather have this specific problem solved either way... just so I can get my mind at ease!


RS Name: Zibl || Click Signature for my RS Life Story!

ziblretieredwarriorchicpc7.jpg

[ 87 Combat ] [ 1240 Total ] [ Ex-RSC Professional Merchant ]

12.20.01 - 10.5.05 || Status: Retired

Total losses in 5 years = just over 630 million gp (BILLIONS in today's prices)

Share this post


Link to post
Share on other sites

Did you forget the double quotes around the message? (visual basic requires strings to have double quotes around them.)


Quote - Revenge is such a nasty thing that only breeds more vengeful souls, but in some situations revenge does not even need to be sought out, but only bided.

Share this post


Link to post
Share on other sites

Hi, all... I went digging, and found out something rather nasty. Look at http://technet.microsoft.com/en-us/library/cc770416.aspx and http://technet.microsoft.com/en-us/library/cc732503%28WS.10%29.aspx, and you'll notice in the 1st page's info and the 2nd page's comments at the bottom that Microsoft limited the "/t" switch to 600 seconds. That's a short 10 freaking minutes, way too little! Also, as Stragomagus said, you'll need double-quotes around the text comment that you wish to have displayed back at yourself. :geek:

 

So, the best you can do is...

shutdown /s /f /t 600 /c "Windows will shutdown in 10 minutes!"

...or...

shutdown /s /force /t 600 /c "Windows will shutdown in 10 minutes!"

...which sucks, in my opinion, a lot. Have fun, if you don't find yourself ripping your hair out first. :(

 

~D. V. "Bloody command-line switches and syntax..." Devnull


tifuserbar-dsavi_x4.jpg and normally with a cool mind.

(Warning: This user can be VERY confusing to some people... And talks in 3rd person for the timebeing due to how insane they are... Sometimes even to themself.)

Share this post


Link to post
Share on other sites

You could do something like this to schedule a task to shut down in an hour.

set h=%TIME:~0,2%
set m=%TIME:~3,2%
set /a h="h+1"
set t=%h%:%m%

at %t% shutdown -f -s -t 120 -c "Windows will shut down in two minutes"

Of course, you may want to do some checks on that hour to make it wrap around from 23:59 to 0:00.

 

Also worth noting, this worked as anticipated (or appears to, I'm not waiting an hour to find out) in a Win 7 Professional (x64) VM:

shutdown -s -f -t 3600


rnHJQwZ.png
In a state of tranquillity, wealth, and luxury, our descendants would forget the arts of war and the noble activity and zeal which made their ancestors invincible. ~Samuel Adams; 1 August, 1776
There are men, in all ages, who mean to exercise power usefully; but who mean to exercise it. They mean to govern well; but they mean to govern. They promise to be kind masters; but they mean to be masters. ~Daniel Webster; 15 March, 1837

Share this post


Link to post
Share on other sites

Just put quotes around the message and remove the "-f" switch. As long as you have the "-t" switch with a time greater than 0, it will imply the "-f" switch automatically.

 

Arguments:

 

No args Display help. This is the same as typing /?.

/? Display help. This is the same as not typing any options.

/i Display the graphical user interface (GUI).

This must be the first option.

/l Log off. This cannot be used with /m or /d options.

/s Shutdown the computer.

/r Shutdown and restart the computer.

/g Shutdown and restart the computer. After the system is

rebooted, restart any registered applications.

/a Abort a system shutdown.

This can only be used during the time-out period.

/p Turn off the local computer with no time-out or warning.

Can be used with /d and /f options.

/h Hibernate the local computer.

Can be used with the /f option.

/e Document the reason for an unexpected shutdown of a computer.

/m \\computer Specify the target computer.

/t xxx Set the time-out period before shutdown to xxx seconds.

The valid range is 0-315360000 (10 years), with a default of 30.

If the timeout period is greater than 0, the /f parameter is

implied.

/c "comment" Comment on the reason for the restart or shutdown.

Maximum of 512 characters allowed.

/f Force running applications to close without forewarning users.

The /f parameter is implied when a value greater than 0 is

specified for the /t parameter.

/d [p|u:]xx:yy Provide the reason for the restart or shutdown.

p indicates that the restart or shutdown is planned.

u indicates that the reason is user defined.

If neither p nor u is specified the restart or shutdown is

unplanned.

xx is the major reason number (positive integer less than 256).

yy is the minor reason number (positive integer less than 65536).

 


wii_wheaton.png

[software Engineer] -

[Ability Bar Suggestion] - [Gaming Enthusiast]

Share this post


Link to post
Share on other sites

Hey, maybe software documentation is good for something after all. :D


rnHJQwZ.png
In a state of tranquillity, wealth, and luxury, our descendants would forget the arts of war and the noble activity and zeal which made their ancestors invincible. ~Samuel Adams; 1 August, 1776
There are men, in all ages, who mean to exercise power usefully; but who mean to exercise it. They mean to govern well; but they mean to govern. They promise to be kind masters; but they mean to be masters. ~Daniel Webster; 15 March, 1837

Share this post


Link to post
Share on other sites

Wow, thanks everyone! All the posts were very helpful. It's been a loooong time I've even been around the TIF, it's awesome to know this place is still running strong ;) .


RS Name: Zibl || Click Signature for my RS Life Story!

ziblretieredwarriorchicpc7.jpg

[ 87 Combat ] [ 1240 Total ] [ Ex-RSC Professional Merchant ]

12.20.01 - 10.5.05 || Status: Retired

Total losses in 5 years = just over 630 million gp (BILLIONS in today's prices)

Share this post


Link to post
Share on other sites

Not sure if this is any help, but im putting it here anyway so others can use it.

 

On Vista+ you can use the "Task Scheduler"

You can use the GUI by searching for "Task Scheduler"

You can also use the command prompt eg:

schtasks /create /SC ONCE /TN "taskname" /TR "C:\Windows\System32\shutdown[Caution: Executable File] /s" /ST 23:10 /RL HIGHEST

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.