ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Program which runs a program then shuts down the computer [Solved]

(1/2) > >>

pschroeter:
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.

MilesAhead:
http://technet.microsoft.com/en-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.

c.gingerich:
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

MilesAhead:
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. :)

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?

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

Navigation

[0] Message Index

[#] Next page

Go to full version