Avatar of school1282
school1282

asked on 

Running continuously cmd line script commands after restart

Hello,

I've got cmd script. Some of its commands demand restart. I need to continue its execution after the restart at the point it interrupted.

Is there way to do it other than putting RunOnce registry key and therefore splitting one cmd file into several parts?

Thanks
Shabby
Web Languages and StandardsOperating Systems

Avatar of undefined
Last Comment
Gastone Canali
ASKER CERTIFIED SOLUTION
Avatar of dovcamp
dovcamp

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of boris711
boris711

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Gastone Canali
Another way to start a process  is  "Scheduled Tasks" choosing the option "When my computer starts"

you can put this batch in the "scheduled tasks" and go
example of batch script

@echo off
if exist *.goto (
     for /f %%i in ('dir /w /b *.goto') do  goto :%%i
) else (
     echo For starting the job chain
     echo you need to create th file FASE1.goto
     echo EX:   echo. ^> FASE1.goto
)    


goto :end

rem ------------------------3 jobs parts--------------------
:FASE1.goto
  echo FASE 1
  Rem your code
 
  del *.goto
  echo. >FASE2.goto
  rem shutdown /r
goto :end
:FASE2.goto
  echo FASE 2
  Rem your code

  del *.goto
  echo. >FASE3.goto
  rem shutdown /r
goto :end
:FASE3.goto
  echo FASE 3
  Rem your code

  del *.goto
  rem ---- stop the execution chain -----
  echo. >END.goto
goto :end

:END.goto
  echo job chain finished!


:end
Avatar of school1282
school1282

ASKER

Thank you canali , but this way I'll be forced to add task scheduling to my unattended installation.
So far, solution of boris711 is most acceptable, which is  accually suggestion of dovcamp .
you should put the my batch:
in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
The sample is divided in 3 phases but you can extend the script as you need
when phase3 is reached every time you reboot script starts but only print "job chain finished!"
for extend
:FASE3.goto
  echo FASE 3
  Rem appropriate part of script based on value to continue processes

  del *.goto
  echo. >step4.goto
goto :end
:step4.goto
 echo step4
  Rem appropriate part of script based on value to continue processes

  del *.goto
  echo. >end.goto
  rem echo.>end.goto -----------------stop the process
goto :end
Web Languages and Standards
Web Languages and Standards

Web development can range from developing the simplest static single page of plain text to the most complex web-based internet applications, electronic businesses, and social network services using a wide variety of languages and standards, including the familiar HTML, JavaScript and jQuery, ASP and ASP.NET, PHP, ColdFusion, CSS, PHP, Flex and Flash, but also the implementation of a broad list of standards including XML, WSDL, SSDL, VoiceXML and many more.

40K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo