Backup and Restore Start Menu Layout in Windows 10


  1. Posts : 4,550
    Windows 11 Pro 64-bit
       #1

    Backup and Restore Start Menu Layout in Windows 10


    Code:
    :: Backup and Restore Start Menu Layout in Windows 10
    
    @Echo Off 
    
    net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
    
    Cls & Mode CON  LINES=11 COLS=80 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.
    Echo           Do You Want to Backup Start Menu Layout in Windows 10 (Y/N)?   
    Echo.       
    Echo.
    Echo.
    
    
    Set /p input= RESPONSE: 
    
    If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start) 
    
    :_Ex
    If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)
    
    
    
    :_Start
    
    Md C:\StartMenuBackup
    
    Reg Export "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount"  C:\StartMenuBackup\Backup.reg /y
    
    Copy /Y "%LocalAppData%\Microsoft\Windows\Shell\DefaultLayouts.xml"  C:\StartMenuBackup
    
    
    
    
    Cls & Mode CON  LINES=11 COLS=50 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.
    Echo            Backing up Start Menu Layout
    Echo.
    Echo.
    Echo. 
    Ping -n 6 localhost >Nul
    Exit
    
    
    :_RegRestore
    
    Reg Delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" /f
    
    Reg Import C:\StartMenuBackup\Backup.reg
    
    Copy /Y C:\StartMenuBackup\DefaultLayouts.xml  "%LocalAppData%\Microsoft\Windows\Shell"
    
    Cls & Mode CON  LINES=11 COLS=50 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.
    Echo            Restoring Start Menu Layout
    Echo.
    Echo.
    Echo. 
    Ping -n 6 localhost >Nul
    
    
    
    
    CHOICE /C YN /M "Press Y to Reboot, N for exiting script."
    
    
    If %errorlevel% == 1 ( Shutdown /r /t 0) Else (Exit)
    Backup and Restore Start Layout in Windows 10
      My Computer


  2. Posts : 191
    Windows 10 Pro x64 latest version
       #2

    nice bat.

    Just a suggestion, when making any bat file I like putting this in at the start, so you can just click on yes on the uac prompt and it gets admin privileges.

    Code:
    :BatchGotAdmin
    @ echo off
    echo Requesting Administrative Privileges for nameofbatfile...
    timeout /t 3 /nobreak >nul
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if '%errorlevel%' NEQ '0' (
    goto UACPrompt
    ) else ( goto gotAdmin )
    :UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
    :gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
    echo Successfully achieved admin rights.....
    timeout /t 3 /nobreak >nul
      My Computers


  3. Posts : 4,550
    Windows 11 Pro 64-bit
    Thread Starter
       #3

    I use below code to prompt for administrator privileges.

    Code:
    net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
      My Computer


  4. Posts : 13,681
    Windows10
       #4

    To: @Brink

    CC: @FreeBooter

    Hey Shawn, it would be nice to add something like this to your tutorial.

    Cheers

    M.
      My Computer


  5. Posts : 191
    Windows 10 Pro x64 latest version
       #5

    FreeBooter said:
    I use below code to prompt for administrator privileges.

    Code:
    net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
    Weird, cause when i copied your code and turned it into bat it didnt work for me when i clicked on yes. But did when i right clicked and ran as admin
      My Computers


  6. Posts : 2,790
    Linux Mint 20.1 Win10Prox64
       #6

    FYI, Here's a little portable program ( <1MB) is doing just that with nice interface. You can save/restore multiple versions of the start menu, reset to original as fresh install.
    Backup Start menu layout v1.3
      My Computer


  7. Posts : 4,550
    Windows 11 Pro 64-bit
    Thread Starter
       #7

    Andrew129260 said:
    Weird, cause when i copied your code and turned it into bat it didnt work for me when i clicked on yes. But did when i right clicked and ran as admin
    I think code does not work when there is space in the file name.
    Last edited by FreeBooter; 06 Oct 2019 at 01:45.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 01:03.
Find Us




Windows 10 Forums