Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
stanian
- Posts: 7
- Joined: 22 Oct 2014 13:10
#1
Post
by stanian » 31 Oct 2014 00:49
So i have batch1 as this
Code: Select all
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V 2 /D "%~d0\bat\batch2.bat /f
and then i reboot computer (windows8) and batch2 starts. It seems like the batch is starting before windows. Because ther is only a black background and the cmdwindow,
When i "x" the batchfile,windows contiune booting. My problem is that i need the computer connectet to internet to get my batch working. So i need the batch to load after the windows is finnish loading.
Any clue?

-
ShadowThief
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
#2
Post
by ShadowThief » 31 Oct 2014 01:20
Don't automatically start batch2.bat?
-
Yury
- Posts: 115
- Joined: 28 Dec 2013 07:54
#3
Post
by Yury » 31 Oct 2014 05:18
Code: Select all
@echo off
set timeout=60
>nul timeout /nobreak /t %timeout%
::::::::::::::::::::::::::::::::::
-
stanian
- Posts: 7
- Joined: 22 Oct 2014 13:10
#4
Post
by stanian » 31 Oct 2014 10:04
Yury wrote:Code: Select all
@echo off
set timeout=60
>nul timeout /nobreak /t %timeout%
::::::::::::::::::::::::::::::::::
But the windows wil not boot until the bach is closed.
-
stanian
- Posts: 7
- Joined: 22 Oct 2014 13:10
#5
Post
by stanian » 31 Oct 2014 10:06
ShadowThief wrote:Don't automatically start batch2.bat?
If that was a solution i have noe created this post.
-
Compo
- Posts: 600
- Joined: 21 Mar 2014 08:50
#6
Post
by Compo » 31 Oct 2014 10:33
Instead of running the batch file from the RunOnce key, add a self delete command to the bottom of it and place a shortcut to your batch file in the startup folder, "%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".
-
Yury
- Posts: 115
- Joined: 28 Dec 2013 07:54
#7
Post
by Yury » 31 Oct 2014 11:00
Compo wrote:Instead of running the batch file from the RunOnce key, add a self delete command to the bottom of it and place a shortcut to your batch file in the startup folder, "%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".
"%AppData%\Microsoft\Windows\Start Menu\Programs\Startup"
-
stanian
- Posts: 7
- Joined: 22 Oct 2014 13:10
#8
Post
by stanian » 31 Oct 2014 13:06
Yury wrote:Compo wrote:Instead of running the batch file from the RunOnce key, add a self delete command to the bottom of it and place a shortcut to your batch file in the startup folder, "%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".
This will not work for me because the batch is in diffrens path from pc to pc. (running from usb)
I got a answer from diffrent forum.
http://superuser.com/questions/834047/batch-is-starting-too-fast-after-reboot/834196#834196
-
Samir
- Posts: 384
- Joined: 16 Jul 2013 12:00
- Location: HSV
-
Contact:
#9
Post
by Samir » 15 Nov 2014 11:57
I saw the solution from the other forum and it only introduces a delay in the execution of the batch file. But if what you really need to check is if there is Internet access you can use something like this:
Code: Select all
:CHKNET
echo.
ECHO Verifying Internet connection, please wait...
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :CHKNET
-
Ed Dyreen
- Expert
- Posts: 1569
- Joined: 16 May 2011 08:21
- Location: Flanders(Belgium)
-
Contact:
#10
Post
by Ed Dyreen » 15 Nov 2014 20:51
I believe windows starts your batch file and then waits for it to complete before loading the desktop and connecting to the internet. if you make the batch start another instance of itself and have the initial instance exit, windows will assume the batch has completed and should continue to load the desktop..
Code: Select all
if /I "%~1" neq "/NEXT" (
start /LOW /B "" "%~0" /NEXT
exit 0
)
echo. the initial batch process has exited, your code here..
-
Samir
- Posts: 384
- Joined: 16 Jul 2013 12:00
- Location: HSV
-
Contact:
#11
Post
by Samir » 15 Nov 2014 22:50
Good thinking Ed, that's important too.
I assumed that problem was solved when the ping delay was hailed as a solution.
-
flippertie
- Posts: 1
- Joined: 16 Nov 2014 23:39
#12
Post
by flippertie » 16 Nov 2014 23:48
Try a different approach:
Create a scheduled task to run the batch file, and set a trigger to run at log-on.
If you need it - under advanced properties there is an option to delay running the task. 30 seconds would probably work.