Skip to content

Instantly share code, notes, and snippets.

@companje
Created January 22, 2012 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save companje/1656945 to your computer and use it in GitHub Desktop.
Save companje/1656945 to your computer and use it in GitHub Desktop.
batchfile
@echo off
cd /d %0\..
SetLocal EnableDelayedExpansion
set menucount=0
call :MenuAdd Run "Run Globe4D"
call :MenuAdd PresentMode "Reboot to Globe4D Present Mode"
call :MenuAdd WindowsMode "Reboot to Windows"
call :MenuAdd IniSettings "Edit Globe4D settings file"
call :MenuAdd UserAccountControl "User Account Control Settings"
call :MenuAdd Display "Display settings"
call :MenuAdd Power "Power settings"
call :MenuAdd AutoLogin "Auto Login Settings"
call :MenuAdd Driver "Install driver"
call :MenuAdd Quicktime "Install Quicktime"
call :MenuAdd Command "Open Command shell"
call :MenuAdd Explorer "Open Explorer"
call :MenuAdd Reboot "Reboot"
call :MenuAdd Shutdown "Shutdown"
call :MenuAdd ExitMenu "Exit Menu"
if [%1]==[/run] goto Run
:Menu
cls
echo.
echo Globe4D - interactive four-dimensional globe
echo Copyright (c) 2005-2012 www.globe4d.com
echo.
for /f "usebackq delims== tokens=1-2" %%i in (`set title`) do echo %%j
echo.
set /p input="> "
set label=!label_%input%!
if [%label%]==[] goto Menu
goto %label%
exit
:MenuAdd
set /a menucount+=1
set myvar=%2
set noquotes=!myvar:"=!
set withzero=0!menucount!
set withzero=!withzero:~-2!
set withspace= !menucount!
set withspace=!withspace:~-2!
set title_%withzero%= %withspace%. %noquotes%
set label_%menucount%=%1
goto :eof
:PresentMode
set shell="%~p0Globe4D.bat /run"
goto SetShell
:WindowsMode
set shell=explorer.exe
goto SetShell
:UserAccountControl
UserAccountControlSettings.exe
cls
echo.
echo The computer needs to be restarted after
echo changing the User Account Control Settings.
echo.
choice /m " Do you want to reboot now?"
if [%errorlevel%]==[1] shutdown /r /t 0
goto Menu
:Command
cls
start cmd
goto Menu
:Explorer
start .
goto Menu
:Run
cls
Globe4D.exe
pause
goto Menu
:IniSettings
start data/Globe4D.ini
goto Menu
:Display
start desk.cpl
goto Menu
:Power
start powercfg.cpl
goto Menu
:Driver
start drivers
start mmc devmgmt.msc
goto Menu
:Quicktime
start tools/QuickTimeInstaller.exe
goto Menu
:AutoLogin
control.exe userpasswords2
goto Menu
:SetShell
reg add "HKLM\Software\Microsoft\Windows NT\Currentversion\Winlogon" /f /v Shell /t REG_SZ /d %shell% >nul 2>&1
if [%errorlevel%]==[1] (
cls
echo.
echo There was a problem changing the Windows Shell.
echo Please first set 'User Account Control' to 'Never notify'
echo.
echo Press a key to open the settings window.
pause > nul
goto UserAccountControl
) else (
cls
goto Reboot
)
:Reboot
echo.
echo Press a key to restart the computer.
pause > nul
shutdown /r /t 0
goto Menu
:Shutdown
cls
echo.
echo Press a key to turn off the computer.
pause > nul
shutdown /s /t 0
goto Menu
:ExitMenu
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment