@echo off

rem ===================
rem GLOBAL VARS
rem ===================

set TOOLS=%SystemDrive%\tools
set SCRIPT_SETTINGS=%TOOLS%\scripts\settings.cmd
set COMPANY_SETTINGS=%TOOLS%\company\settings.cmd
set CUSTOM_SCRIPT=%TOOLS%\company\custom.cmd
set USERCONFIG_DONE="%LOCALAPPDATA%"\.userconfig_done
set EMLICENSE_DONE="%LOCALAPPDATA%"\.emlicense_done
set STARTMENU=%APPDATA%\Microsoft\Windows\Start Menu\Programs
set STARTMENU_PUBLIC=%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs

rem ===================
rem DEFAULTS
rem ===================

set bgcol_R=0
set bgcol_G=0
set bgcol_B=0
set LANG=en-US
set localadmin=localadmin
set emclient_license=0
set seafile_domain=0
set install_aerolite=0
set preserve_savedgames_folder=1
set start_desktopinfo=0
set bluetooth_networking=0
set ms_tcpip6=0
set ms_implat=0
set ms_server=0

echo ####### %0 #######

rem ===================
rem CONFIGFILE CHECKS
rem ===================

echo.
echo searching for SCRIPT settings ...
if NOT EXIST %SCRIPT_SETTINGS% (
  echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
) else (
  echo OK. Loading SCRIPT settings ...
  call %SCRIPT_SETTINGS%
)

echo.
echo searching for COMPANY settings ...
if NOT EXIST %COMPANY_SETTINGS% (
  echo INFO: config file %COMPANY_SETTINGS% NOT FOUND
) else (
  echo OK. Loading COMPANY settings ...
  call %COMPANY_SETTINGS%
)

rem ================================================
rem GENERIC SETTINGS FOR THE USER (this runs always)
rem ================================================

echo.
echo #####
echo ##### GENERIC tasks and settings
echo #####
echo.

rem show language settings ...
echo INFO: language is set to [ %LANG% ]

rem remove desktop wallpaper, set desktop colour and start desktopinfo
call :DESKTOPINFO
echo.

rem set RECYCLE BIN limits ...
powershell -command %TOOLS%\scripts\set-recyclebin.ps1
echo.

rem set filetype associations ...
call %TOOLS%\scripts\set-filetypes.cmd
echo.

echo Remapping Desktop folder to standard location ...
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" ^
  /v Desktop /t REG_EXPAND_SZ /d "%USERPROFILE%\Desktop" /f 1>nul

rem NO seafile Autostart for the Admin!
if EXIST "%ProgramFiles%\Seafile\bin\seafile-applet.exe" if "%USERNAME%" NEQ "%localadmin%" (
  echo Setting autostart for SEAFILE client ...
  reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ^
    /v Seafile /t REG_SZ /d "%ProgramFiles%\Seafile\bin\seafile-applet.exe" /f 1>nul
)

rem fix for broken SEAFILE folder access rights ...
if EXIST "%USERPROFILE%"\Seafile (
  echo Removing "system" attribute on SEAFILE storage folder ...
  attrib -S "%USERPROFILE%"\Seafile /S /D 1>nul 2>nul
)

rem ===================
rem EMCLIENT LICENSING
rem ===================

rem licensing for emClient already done ?
if EXIST %EMLICENSE_DONE% GOTO EMCLIENT_DONE

rem no emClient for the Admin!
if "%USERNAME%" == "%localadmin%" GOTO EMCLIENT_DONE

if %emclient_license% == 0 (
  echo no emClient license found!
) else (
  echo.
  if EXIST "%ProgramFiles(x86)%\eM Client\MailClient.exe" (
    echo Adding emClient license ...
    "%ProgramFiles(x86)%\eM Client\MailClient.exe" /activate %emclient_license%

    rem create a statusfile (this codeblock must be executed only once per use) ...
    echo 1 >%EMLICENSE_DONE%

  ) else (
    echo emClient is NOT installed!
  )
  echo.
)

:EMCLIENT_DONE

rem =====================================================
rem ACCOUNT TWEAKS AND CONFIG FILES (this runs only once)
rem =====================================================

rem User tweaks already done ?
if EXIST %USERCONFIG_DONE% GOTO USERTWEAKS_DONE

echo.
echo #####
echo ##### INITIAL account setup
echo #####
echo.

rem ============
rem ADMIN RIGHTS
rem ============

isuseradmin
if %ERRORLEVEL% == 0 (

  echo Disabling unwanted NETWORK features ...
  call %TOOLS%\scripts\disable-networkfeatures.cmd 1>nul 2>nul

  echo Cleaning up tiles in the START menu ...
  call %TOOLS%\scripts\cleanup-tiles.cmd 1>nul 2>nul

  rem ... stupid OS!
  rem why the heck is the Startmenu entry for "System Tools" installed per user ? stupid Microsoft.
  echo Moving system tools links ...
  move /Y "%STARTMENU%\System Tools\*.*" ^
    "%STARTMENU_PUBLIC%\System Tools" 2>nul

  rem Removing and renaming objects in the "System Tools" folder...
  move /Y "%STARTMENU_PUBLIC%\System Tools\computer.lnk" ^
    "%STARTMENU_PUBLIC%\System Tools\This PC.lnk" 1>nul 2>nul
  del /F "%STARTMENU_PUBLIC%\System Tools\Command Prompt.lnk" 2>nul

  rem moving Powershell ISE icons ...
  move /Y "%STARTMENU_PUBLIC%\Windows Powershell\Windows PowerShell ISE.lnk" ^
    "%STARTMENU_PUBLIC%\System Tools" 2>nul
  rd /S /Q "%STARTMENU_PUBLIC%\Windows Powershell"

)

rem ===========
rem USER RIGHTS
rem ===========

rem setting Aerolite theme...
if %install_aerolite% == 1 (
  call %TOOLS%\scripts\modify-desktoptheme.cmd
  call :DESKTOPINFO
  echo.
)

echo Creating workspace folder ...
mkdir "%USERPROFILE%"\workspace 1>nul 2>nul

echo Setting up SSH client ...
mkdir "%USERPROFILE%"\.ssh 1>nul 2>nul
copy /Y %TOOLS%\scripts\config\ssh-config.txt "%USERPROFILE%"\.ssh\config 1>nul 2>nul

echo Installing a VIM configuration ...
copy /Y %TOOLS%\scripts\config\vimrc.txt "%USERPROFILE%"\.vimrc 1>nul 2>nul

echo Setting up WINDOWS TERMINAL ...
set LOCALSTATE="%LOCALAPPDATA%"\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
mkdir %LOCALSTATE% 1>nul 2>nul
copy /Y %TOOLS%\scripts\config\wt-settings.json %LOCALSTATE%\settings.json 1>nul 2>nul

echo Setting up VS-Code ...
mkdir "%USERPROFILE%"\AppData\Roaming\Code\User 1>nul 2>nul
copy /Y %TOOLS%\scripts\config\vscode-settings.json "%USERPROFILE%"\AppData\Roaming\Code\User\settings.json 1>nul 2>nul

echo disabling RUFUS autoupdate ...
reg add "HKCU\SOFTWARE\Akeo Consulting\Rufus" /v UpdateCheckInterval ^
  /t REG_DWORD /d "0xffffffff" /f 1>nul

rem TOTALCOMMANDER
mkdir "%APPDATA%"\GHISLER 1>nul 2>nul
if NOT EXIST "%APPDATA%"\GHISLER\WINCMD.ini (
  echo Copying standard inifile for TOTALCOMMANDER ...
  copy /Y %TOOLS%\optional\config\WINCMD.ini "%APPDATA%"\GHISLER 1>nul 2>nul
)
if NOT EXIST "%APPDATA%"\GHISLER\wcx_ftp.ini (
  echo Copying standard TOTALCOMMANDER ftp config file ...
  copy /Y %TOOLS%\optional\config\wcx_ftp.ini "%APPDATA%"\GHISLER 1>nul 2>nul
)

echo Adding "This PC" icon for current user on desktop Windows 10 ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" ^
 /v "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /t REG_DWORD /d 0 /f 1>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" ^
 /v "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /t REG_DWORD /d 0 /f 1>nul

echo Refreshing the desktop (W10 style) ...
ie4uinit.exe -show

echo Adding "seconds" display to clock ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ^
  /v "ShowSecondsInSystemClock" /t REG_DWORD /d 1 /f 1>nul

echo Setting the "GLOBAL" view mode for windows EXPLORER ...
echo.
powershell -command %TOOLS%\scripts\set-explorer-viewmode.ps1
echo.

echo Enabling the "show file extensions" feature in explorer ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ^
  /v "HideFileExt" /t REG_DWORD /d 0 /f 1>nul

echo Do not add "-Shortcut" text to the name of newly created shortcuts ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" ^
  /v "link" /t REG_BINARY /d "00000000" /f 1>nul

echo Disabling the search box on the taskbar ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" ^
  /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f 1>nul

echo Disabling the multi tasking view button on the taskbar ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ^
  /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f 1>nul

echo Disabling the cortana button on the taskbar ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ^
  /v "ShowCortanaButton" /t REG_DWORD /d 0 /f 1>nul

echo Loading the OpenShell configuration ...
rem config must be full qualified pathname (OpenShell BUG!)
set CONFIG=%TOOLS%\scripts\config\OpenshellSettings.xml
"%ProgramFiles%\Open-Shell\StartMenu.exe" -xml %CONFIG%

echo.
echo Removing the "user" folders from the explorer navigation pane ...
for %%K in (
  {0DB7E03F-FC29-4DC6-9020-FF41B59E513A}
  {B4BFCC3A-DB2C-424C-B029-7FE99A87C641}
  {D3162B92-9365-467A-956B-92703ACA08AF}
  {088E3905-0323-4B02-9826-5D99428E115F}
  {3DFDF296-DBEC-4FB4-81D1-6A3438BCF4DE}
  {24AD3AD4-A569-4530-98E1-AB02F9417AA8}
  {F86FA3AB-70D2-4FC7-9C99-FCBF05467F3A}
) do (
  echo %%K
  reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideMyComputerIcons" ^
    /v "%%K" /t REG_DWORD /d 1 /f 1>nul
)
echo.

echo Adding the home folder to the explorer navigation pane ...
reg add "HKCU\Software\Classes\CLSID\{59031a47-3f72-44a7-89c5-5595fe6b30ee}" ^
  /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d 1 /f 1>nul

echo Make explorer show "This PC" on top ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ^
  /v "LaunchTo" /t REG_DWORD /d 1 /f 1>nul

echo Cleaning up recent files and libraries ...
del /F /Q "%APPDATA%"\Microsoft\Windows\Recent\AutomaticDestinations\* 2>nul
del /F /Q "%APPDATA%"\Microsoft\Windows\Recent\* 2>nul
del /F /Q "%APPDATA%"\Microsoft\Windows\Libraries\* 2>nul

echo Disabling frequent and recent files view in explorer ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" ^
  /v "ShowRecent" /t REG_DWORD /d 0 /f 1>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" ^
  /v "ShowFrequent" /t REG_DWORD /d 0 /f 1>nul

echo Disabling notification center ...
reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer" ^
  /v "DisableNotificationCenter" /t REG_DWORD /d 1 /f 1>nul

echo Disabling push notifications ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications" ^
  /v "ToastEnabled" /t REG_DWORD /d 0 /f 1>nul

echo Disabling autoplay ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" ^
  /v "DisableAutoplay" /t REG_DWORD /d 1 /f 1>nul

echo Disabling beeping ...
reg add "HKCU\Control Panel\Sound" /v "Beep" /t REG_SZ /d "no" /f 1>nul

rem no SEAFILE for the Admin!
if "%USERNAME%" == "%localadmin%" GOTO SEAFILE_DONE

echo.
echo preparing the SEAFILE configuration
echo ########################################
echo.

echo setting path for filestore ...
reg add "HKCU\SOFTWARE\SeaFile" ^
  /v "PreconfigureDirectory" /d "%USERPROFILE%" /t REG_SZ /f 1>nul

echo guessing SEAFILE username and setting a dummy token...
if seafile_domain == 0 (
  echo no SeaFile domain found - cannot guess username!
) else (
  reg add "HKCU\SOFTWARE\SeaFile" ^
    /v "PreconfigureUsername" /d "%USERNAME%@%seafile_domain%" /t REG_SZ /f 1>nul
  reg add "HKCU\SOFTWARE\SeaFile" ^
    /v "PreconfigureUserToken" /d "dummy" /t REG_SZ /f 1>nul

  rem hide seafile main window ...
  reg add "HKCU\SOFTWARE\SeaFile\Seafile Client\Behavior" ^
    /v "hideMainWindowWhenStarted" /d "true" /t REG_SZ /f 1>nul
)
:SEAFILE_DONE

echo.
echo reorganizing start menu and desktop
echo ########################################
echo.

echo Removing OneDrive link in start menu ...
del /F /Q "%APPDATA%\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" 2>nul

rem ... stupid OS! (it pins "dead" icons to the taskbar)
echo Removing all pinned icons from taskbar ...
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /f > NUL 2>&1

call :RESTART_EXPLORER

rem create a statusfile (this codeblock must be executed only once per user) ...
echo 1 >%USERCONFIG_DONE%

:USERTWEAKS_DONE

rem ========================================
rem ACCOUNT CLEANUP AND FIXES (runs always)
rem ========================================

echo.
echo #####
echo ##### CLEANUP
echo #####

rem ============
rem ADMIN RIGHTS
rem ============

isuseradmin
if %ERRORLEVEL% == 0 (

  echo.
  call %TOOLS%\scripts\uninstall-onedrive.cmd

  echo.
  call %TOOLS%\scripts\uninstall-edge.cmd

  echo.
  call %TOOLS%\scripts\uninstall-pchealth.cmd

  rem ... stupid OS!
  rem why the heck is the Startmenu entry for "Accessibility Tools" installed per user ? stupid Microsoft.
  rem must be done (here) more than once, because Microsoft patches can reinstall some tools ...
  echo.
  echo Moving accessibility tools to accessories folder ...
  move /Y "%STARTMENU%\Accessibility\*.*" ^
    "%STARTMENU_PUBLIC%\Accessories" 2>nul

  move /Y "%STARTMENU_PUBLIC%\Accessibility\*.*" ^
    "%STARTMENU_PUBLIC%\Accessories" 2>nul

  echo Removing public accessibility tools folder ...
  rd /S /Q "%STARTMENU_PUBLIC%\Accessibility" 2>nul

  echo Moving "settings" link to system tools folder ...
  attrib -S "%STARTMENU_PUBLIC%\Immersive Control Panel.lnk" 1>nul 2>nul
  move /Y "%STARTMENU_PUBLIC%\Immersive Control Panel.lnk" ^
    "%STARTMENU_PUBLIC%\System Tools" 2>nul

  rem setting permissions for normal users ...
  icacls "%STARTMENU_PUBLIC%\System Tools\*" /grant Users:R 1>nul
  icacls "%STARTMENU_PUBLIC%\Administrative Tools\*" /grant Users:R 1>nul
  icacls "%STARTMENU_PUBLIC%\Accessories\*" /grant Users:R 1>nul

  rem - sigh - this zombie (chrome) keeps coming back ...
  echo Disabling chrome update tasks ...
  powershell -Command "Get-ScheduledTask | where TaskName -like 'Google*' | Disable-ScheduledTask"

  rem same with OneDrive. This little sucker keeps coming back ...
  echo removing OneDrive update task ...
  powershell -Command "Get-ScheduledTask | Where-Object {$_.Taskname -match 'OneDrive Standalone Update'} | Unregister-ScheduledTask -Confirm:$false"

  echo disabling some network cards and protocols ...

  rem BlueTooth ...
  if %bluetooth_networking% == 0 (
    powershell -Command "Disable-NetAdapter -Name 'Bluetooth Network Connection' -Confirm:$false" 1>nul 2>nul
  ) else (
    powershell -Command "Disable-NetAdapter -Name 'Bluetooth Network Connection' -Confirm:$true" 1>nul 2>nul
  )
  powershell -Command "Get-NetAdapter"

  rem IPv6 ...
  if %ms_tcpip6% == 0 (
    powershell -Command "Disable-NetAdapterBinding -Name '*' -ComponentID ms_tcpip6"
  ) else (
    powershell -Command "Enable-NetAdapterBinding -Name '*' -ComponentID ms_tcpip6"
  )
  powershell -Command "Get-NetAdapterBinding -ComponentID ms_tcpip6"


  rem File sharing ...
  if %ms_server% == 0 (
    powershell -Command "Disable-NetAdapterBinding -Name '*' -ComponentID ms_server"
  ) else (
    powershell -Command "Enable-NetAdapterBinding -Name '*' -ComponentID ms_server"
  )
  powershell -Command "Get-NetAdapterBinding -ComponentID ms_server"


  rem Multiplexor protocol ...
  if %ms_implat% == 0 (
    powershell -Command "Disable-NetAdapterBinding -Name '*' -ComponentID ms_implat"
  ) else (
    powershell -Command "Enable-NetAdapterBinding -Name '*' -ComponentID ms_implat"
  )
  powershell -Command "Get-NetAdapterBinding -ComponentID ms_implat"

) else (

  rem ===========
  rem USER RIGHTS
  rem ===========

  echo Removing accessibility tools folder ...
  rd /S /Q "%STARTMENU%\Accessibility" 2>nul

  echo Removing users accessories folder ...
  rd /S /Q "%STARTMENU%\Accessories" 2>nul

  echo Removing users system tools folder ...
  rd /S /Q "%STARTMENU%\System Tools" 2>nul

)

rem ===========
rem USER RIGHTS
rem ===========

echo.
echo Cleaning users home directory
echo ########################################
echo.

rem WARNING!
rem DO NOT remove the "PICTURES" folder!
rem this is used and needed by the snipping tool!

echo removing folder "3D Objects" ...
rd /S /Q "%USERPROFILE%\3D Objects" 2>nul

echo removing folder "Links" ...
rd /S /Q "%USERPROFILE%\Links" 2>nul

if %preserve_savedgames_folder% == 0 (
  echo removing folder "Saved Games" ...
  rd /S /Q "%USERPROFILE%\Saved Games" 2>nul
)

echo removing folder "Searches" ...
rd /S /Q "%USERPROFILE%\Searches" 2>nul

for %%D in (

  Contacts
  Documents
  Favorites
  Music
  Searches
  Videos

) do (

  echo %%D ...
  attrib -R -S -H "%USERPROFILE%"\%%D 1>nul 2>nul
  attrib -R -S -H "%USERPROFILE%"\%%D\desktop.ini 1>nul 2>nul
  del /F /Q "%USERPROFILE%"\%%D\desktop.ini 2>nul
  rmdir /Q "%USERPROFILE%"\%%D 2>nul

)

rem delete strange "about" link in IrfanView Startmenu folder ...
del /F /Q  "%STARTMENU_PUBLIC%\IrfanView\About IrfanView.lnk" 2>nul

echo.
echo Deleting chrome cache and history ...
taskkill /f /im chrome.exe /FI "USERNAME eq %USERNAME%" 2>nul
rd /S /Q %USERPROFILE%"\AppData\Local\Google\Chrome\User Data\Default\Cache" 2>nul
del /F /Q %USERPROFILE%"\AppData\Local\Google\Chrome\User Data\Default\History*" 2>nul
del /F /Q %USERPROFILE%"\Desktop\Google Chrome.lnk" 2>nul

echo.
echo Other tasks and fixes for the user
echo ########################################
echo.

echo Removing even more startmenu crap ...
rd /S /Q "%STARTMENU%\Accessories" 2>nul
rd /S /Q "%STARTMENU%\Accessibility" 2>nul
rd /S /Q "%STARTMENU%\Administrative Tools" 2>nul
rd /S /Q "%STARTMENU%\Maintenance" 2>nul
rd /S /Q "%STARTMENU%\System Tools" 2>nul
rd /S /Q "%STARTMENU%\Windows Powershell" 2>nul

rem ... stupid OS!
rem IE is such a zombie. I's coming back all the time ...
echo Removing IE link in users start menu ...
del /F "%STARTMENU%\Accessories\Internet Explorer.lnk" 2>nul

rem ... stupid OS!
rem Edge is a zombie too!
echo Removing microsoft edge links in start menu and desktop ...
del /F "%STARTMENU%\Microsoft Edge.lnk" 2>nul
del /F "%USERPROFILE%\Desktop\Microsoft Edge.lnk" 2>nul

rem re-create "Pictures" in case it was deleted ...
echo Creating "Pictures" folder for snipping tool ...
mkdir "%USERPROFILE%\Pictures" 2>nul

rem HeidiSQL should be in english - always!
echo Setting language of HeidiSQL to english ...
reg add "HKCU\SOFTWARE\HeidiSQL" ^
    /v "Language" /d "en" /t REG_SZ /f 1>nul

rem workstation service should run always ...
echo.
echo Starting the workstation service ...
net start workstation 1>nul 2>nul
net config workstation

rem =================================================
rem search for custom script (only with ADMIN rights)
rem =================================================

isuseradmin
if %ERRORLEVEL% == 0 (
  if EXIST %CUSTOM_SCRIPT% (
    echo OK. Calling custom script ...
    call %CUSTOM_SCRIPT%
  )
)

goto END

rem ####################################################

:DESKTOPINFO
echo Removing the desktop wallpaper ...
reg add "HKCU\Control Panel\Desktop" /v WallPaper /t REG_SZ /d " " /f 1>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" /v BackgroundType /t REG_DWORD /d 1 /f 1>nul
ping 127.0.0.1 -n 3 >nul 2>nul
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

echo Setting desktop COLOUR ...
%TOOLS%\setbgcol %bgcol_R% %bgcol_G% %bgcol_B%

if %start_desktopinfo% == 1 (
  echo Starting the Desktopinfo tool ...
  taskkill /F /IM DesktopInfo64.exe /FI "USERNAME eq %USERNAME%" 2>nul
  start /B "" %TOOLS%\desktopinfo\DesktopInfo64.exe /ini=%TOOLS%\desktopinfo\desktopinfo.ini
)

rem kill settings window
rem (in case it hasn't been killed by the modify script)
taskkill /F /IM SystemSettings.exe /FI "USERNAME eq %USERNAME%" 2>nul

goto :eof

:RESTART_EXPLORER
echo Restarting windows explorer ...
taskkill /f /im explorer.exe /FI "USERNAME eq %USERNAME%" 2>nul
ping 127.0.0.1 -n 3 >nul 2>nul
start explorer.exe
goto :eof

:END
echo.
echo ####### %0 #######

