AUTOEXEC.BAT option to shut down PC?

In Windows, sometimes I use an autoexec.bat file to render several yafray XML files in a row, during the night for instance.

My question is if there is an option for AUTOEXEC files to shut down the PC. In this way the computer can shut down itself when the renders are finished.

Is there a better approach available?

You can have the batch file execute shutdown.exe (as shutdown -s ) from Windows/system32.

why are you using autoexec.bat instead of the runonce registry key or even the startup folder in the program files folder [for all users or your particular user]

hell, what version of windows are you running that you thought autoexec.bat was still a good idea?

… well anyway, PLEASE make your own batch file instead of messing with a system one [one batch file can call another, or you can run them like any program]

oh, and the shutdown command is only in windows xp or windows 2000, if you’re running 98 or ME there’s some ugly thing with rundll you can do to shutdown your computer.

C:\WINDOWS\RUNDLL.EXE user.exe,exitwindows

[or that’s the first thing I found]

shutdown -s -t 0

[windows xp]

why are you using autoexec.bat

well, I use an AUTOEXEC file created by myself to render several yafray scenes in a row. This would be the aspect of the AUTOEXEC.BAT:

C:\"Program Files"\yafray\yafray ybtest01D.xml
C:\"Program Files"\yafray\yafray ybtest02D.xml
C:\"Program Files"\yafray\yafray ybtest03D.xml
C:\"Program Files"\yafray\yafray ybtest04D.xml

It is a very old trick from an old veteran, I know. It is the best solution I come up with.

I execute the file in a MS DOS terminal windows in WIN XP.
The AUTOEXEC is in the scenes folder.
Many times I would like the PC to shut dow itself once the last render is finished (and saved) because I’m not at home or I’m sleeping.

Thanks for your answers.


So you’re created a new batch file and not editing the system one?

I still don’t see what’s wrong with just adding:
shutdown -s -t 0
like above mentioned to the end of the batch file?

Thanks for the answer everyone


have a look at this one:

Not batch rendering, but close and you can steal the code :wink: