topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 2:29 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Program which runs a program then shuts down the computer [Solved]  (Read 9272 times)

pschroeter

  • Participant
  • Joined in 2009
  • *
  • Posts: 2
    • View Profile
    • Donate to Member
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 AM by pschroeter »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #1 on: September 18, 2012, 12:47 AM »
http://technet.micro...ibrary/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

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #2 on: September 18, 2012, 03:58 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

Clipboard_20120918.png

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #3 on: September 18, 2012, 04:25 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. :)

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 PM by MilesAhead »

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #4 on: September 18, 2012, 05:34 PM »
I should be able to do that. I'll add that either later tonight or tomorrow.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #5 on: September 18, 2012, 05:39 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. :)

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #6 on: September 22, 2012, 01:31 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

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #7 on: September 22, 2012, 03:19 PM »
Looks cool. :)

Josh

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Points: 45
  • Posts: 3,411
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #8 on: September 22, 2012, 04:03 PM »
Check this out, built into windows. You might need to install the group policy console.

http://www.trishtech...own_in_windows_7.php

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Program which runs a program then shuts down the computer
« Reply #9 on: September 22, 2012, 10:18 PM »
Check this out, built into windows. You might need to install the group policy console.

http://www.trishtech...own_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.