Welcome Guest.   Make a donation to an author on the site August 28, 2014, 02:14:11 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: Program which runs a program then shuts down the computer [Solved]  (Read 2766 times)
pschroeter
Participant
*
Posts: 2


View Profile Give some DonationCredits to this forum member
« on: September 18, 2012, 12:14:22 AM »

I would like a little program which I can click on which runs a program (SyncToy), waits for it to finish, then shuts down the computer (Windows XP). I am not trying to run the program every time I shut down so I don’t need a scheduled task.

I believe this could be down with a batch file but I am not competent to write it. I’m afraid I’ll get something wrong and SyncToy will start to run and the computer will launch a shut down in the middle and scramble my backups.

The program I want to run before shutdown is SyncToy 2.1 with this path and parameters: "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" –r

UPDATE SOLVED: September 27
Thanx to anyone who tried to help. I just want to mention that after asking someone I figured out this Batch File code which works:

Start "" /Wait "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
shutdown -s

I cannot figure out any rhyme or reason as to where the quote symbols go. I see quotes around /Wait and have no idea whats going on, I only know it works.
« Last Edit: September 27, 2012, 12:57:48 AM by pschroeter » Logged
MilesAhead
Member
**
Posts: 4,787



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: September 18, 2012, 12:47:54 AM »

http://technet.microsoft....-us/library/bb491003.aspx

Use a .cmd file with simpler commands above shutdown.exe in the batch until you feel you have it perfected. I really don't want to write scripts that mess with people's backups. Esp. since I never use SyncToy and have no idea what a "bad param" is.
Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
c.gingerich
Supporting Member
**
Posts: 478



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: September 18, 2012, 03:58:08 PM »

I made a quick app called RunAnd... it can run an app, then when the app closes it can Reboot, Logoff, Shutdown or ForceShutdown.

You can add parameters to the end also. So you can use "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" –r in the App To Run box. Use at your own risk as if you use ForceShurtown it will NOT allow you to save any changes to open documents and as stated by @MilesAhead, make sure to use the correct parameters to the App To Run.

Gives a 10 second count to give you a chance to cancel.

https://www.box.com/shared/fjivgtlgp9qn0r06t0kb

Logged

MilesAhead
Member
**
Posts: 4,787



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: September 18, 2012, 04:25:40 PM »

I considered doing something like a FileOpenDialog with .lnk file type as default file type. This would allow selecting a shortcut with all params and window startup type already filled in and presumably tested.  IOW, the shortcut you usually use to run the task. But I don't think there are that many long tasks that would have a shutdown option, that don't have a checkbox or option for it already provided.  For example large file download programs like binary news readers usually have an option to shut down when done.  Video conversion, same thing. Image backup programs etc.. For that reason I figured batch is good enough.

For shutdown type first param on command line would be good enough. But some people just prefer Gui for everything. smiley

edit: if I could offer some suggestions.. How about your Gui generating a shortcut to the RunThenShutdown app with all the info filled in instead of launching directly?  That way the work is saved and shortcuts for multiple things, if there's a need for it, can be made with shutdown when done logic built in?  Perhaps even have drag & drop so the user can drop an existing shortcut on the Gui?

« Last Edit: September 18, 2012, 04:51:35 PM by MilesAhead » Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
c.gingerich
Supporting Member
**
Posts: 478



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: September 18, 2012, 05:34:01 PM »

I should be able to do that. I'll add that either later tonight or tomorrow.
Logged

MilesAhead
Member
**
Posts: 4,787



View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: September 18, 2012, 05:39:10 PM »

I should be able to do that. I'll add that either later tonight or tomorrow.

Cool. I think that will make it a generally useful utility for the toolbox. smiley
Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
c.gingerich
Supporting Member
**
Posts: 478



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: September 22, 2012, 01:31:29 PM »

I have update Run And..., You can now have a shortcut created on your desktop and also use it via command line.

RunAnd.exe "Full path to EXE + parameters" "And..." /Autorun

"And..." options are Reboot, LogOff, Shutdown and ForceShutdown

/Autorun is optional, it will auto run the app

Example: RunAnd.exe "C:\Windows\notepad.exe" "LogOff" /Autorun
Logged

MilesAhead
Member
**
Posts: 4,787



View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: September 22, 2012, 03:19:09 PM »

Looks cool. smiley
Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
Josh
Charter Honorary Member
***
Posts: 3,324



View Profile Give some DonationCredits to this forum member
« Reply #8 on: September 22, 2012, 04:03:23 PM »

Check this out, built into windows. You might need to install the group policy console.

http://www.trishtech.com/...shutdown_in_windows_7.php
Logged

Strength in Knowledge
app103
That scary taskbar girl
Global Moderator
*****
Posts: 5,170



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: September 22, 2012, 10:18:09 PM »

Check this out, built into windows. You might need to install the group policy console.

http://www.trishtech.com/...shutdown_in_windows_7.php

Something tells me that policy isn't quite what he wants.

I am not trying to run the program every time I shut down so I don’t need a scheduled task.

Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.041s | Server load: 0.04 ]