Search code examples
windowsgoogle-chromebatch-filekioskkiosk-mode

Google chrome - not launching from top and left 0 pixels


enter image description here

Google Chrome Stable i am using in Windows 8.1 and in Windows 8.1 Pro from the startup path as following:

timeout 5 > nul
ping 127.0.0.1 -n 11 > nul
@start /b cmd /c "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk http://www.stackoverflow.com
  • 10% times on boot it works exactly as full-screen mode.

  • BUT, 90% times on boot it does not work, it launch the Chrome but it does not launch it from top, left 0 pixel

  • if i manually run that batch file then 100% time it works successfully, but when its automated then it start to mess

Can anyone please help? (i have been having this issue for about 3 months now, and its getting worst because cant find any solution yet to resolve this issue permanently)


Solution

  • I'm working on windows 7 32 bits, so i created this vbscript in order to create a shortcut in the startup folder and to launch the batch file in hidden mode.

    Shortcut4Batch.vbs

    Option Explicit
    Dim PathApplication,ShortcutName,VbsPath
    VbsPath = Wscript.ScriptFullName
    PathApplication = "C:\Users\Hackoo\Desktop\Hackoo\BAT\stackoverflow\KioskChrome.bat"
    ShortcutName = "KioskChrome"
    Call Shortcut(VbsPath,ShortcutName)
    Call Hidden_Run(Dblquote(PathApplication))
    '*********************************************************************************
    Sub Shortcut(PathApplication,ShortcutName)
        Dim objShell,StartFolder,objShortCut,MyTab
        Set objShell = CreateObject("WScript.Shell")
        MyTab = Split(PathApplication,"\")
        If ShortcutName = "" Then
            ShortcutName = MyTab(UBound(MyTab))
        End if
        StartFolder = objShell.SpecialFolders("Startup")
        Set objShortCut = objShell.CreateShortcut(StartFolder & "\" & ShortcutName & ".lnk")
        objShortCut.TargetPath = Dblquote(PathApplication)
        ObjShortCut.IconLocation = "%SystemRoot%\system32\SHELL32.dll,-25"
        objShortCut.Save
    End Sub
    '*********************************************************************************
    Function DblQuote(Str)
        DblQuote = Chr(34) & Str & Chr(34)
    End Function
    '*********************************************************************************
    Function Hidden_Run(MyProgram)
        Dim ws,Result
        Set ws = CreateObject("wscript.Shell")
        Result = ws.run(MyProgram,0,True) '0 to hide the program
        Hidden_Run = Result
    End Function
    '*********************************************************************************
    

    KioskChrome.bat

    @echo off
    @start /b cmd /c "%programfiles%\Google\Chrome\Application\chrome.exe" --kiosk http://www.stackoverflow.com