I am trying to write a script for my desktop that will start the OptimizeMonthly.MyD from the MyDefrag Scripts folder and when completed, shut the PC down.
I do not want to change the original OptimizeMonthly.MyD or the Settings.MyD that MyDefrag installs as program updates will over-write these and I would then have to change again.
The script I have been trying, defrags C: drive
but once done will not automatically exit Mydefrag and run the shutdown routine.
As soon as I manually exit MyDefrag the shutdown routine runs and shuts down the PC.
I have done lots of Googling and experimentation but can not get it to work fully
, hence my request for guideance here.
This is the base script i have been experimenting with.
ECHO PERFORMING DEFRAG...
cd "C:\Programs-Utilities & Tools\MyDefrag\Scripts\"
start /wait OptimizeMonthly.MyD C:
/* Automatically exit MyDefrag when it is finished. */
start %systemroot%\system32\SHUTDOWN.exe -s -f -t 30
Happy and appreciative if someone wants to fix my script or write one that works.
Thanks in anticipation.