1.

Solve : Can Batch file continue after reboot/restart??

Answer»

I'm writing a batch file to install a few pieces of software, but each require a restart, and do the restart automatically because I have them doing the installs unattended/passive/quiet. They must stay unattended/passive/quiet and must restart before the next can begin for each to install properly in order. To give an idea, the software is Windows Service pack, Program, Program.

Can the batch file continue it's process after a restart? I would also need it to auto-logon and re-establish a connection with the mapped drive.Installing something secretly..........sounds a bit strange to me..........

I think the only way to have a file start after restart is by USING Scheduled Tasks.I found the perfect solution to my problem. No secrets about the software, I just didn't think it made a DIFFERENCE what it was in the problem.

To solve my problem, I created a series of batch files that will do the whole process. First, I turned on Auto Logon so that with each restart, it'll just get BACK into the user and continue. The first batch file runs from removable media. It will MAP a network drive (/persistent:no), create the dir c:\tempdir\ and copy two files down from it's mapped drive. One named "5.BAT" to the newly created directory, and one named "start.bat" to the Startup folder in program files. Lastly, the first bat from removable media will install one program from the map drive and the computer restarts.

Start.bat:

C:\tempdir\1.bat
C:\tempdir\2.bat
C:\tempdir\3.bat
C:\tempdir\4.bat
C:\tempdir\5.bat

5.bat remaps the drive (/persistent:no), will copy 4.bat into the \tempdir\, install one program and restart.

4.bat remaps the drive (/persistent:no), will copy 3.bat into the \tempdir\, delete 5.bat, install one program and restart.

3.bat remaps the drive (/persistent:no), will copy 2.bat into the \tempdir\, delete 4.bat, install one program and restart and so on until 1.bat installs it's last program not requiring restart which ends by deleting start.bat and \tempdir\.

For some reason, it took me a while to see this plan of action. But once I started, it was very simple. The /persistent:no when mapping the drive avoids the reconnection password prompt at each restart. Hopefully this can be of help to someone else.

Cheers



Discussion

No Comment Found