@echo off
set wdf="C:\Users\Default\AppData\Roaming"
set wcf="%AppData%"
set host1=%C:\Windows\System32\drivers\etc\hosts%
set host2=%C:\Windows\System32\drivers\etc\hosts_"%date:~10,4%.%date:~7,2%.%date:~4,2%-%time:~1,1%h%time:~3,2%m%time:~6,2%s"%
REM #Config_Service_File
echo sapmsMH2 3600/tcp >>C:\Windows\System32\drivers\etc\services
REM #Config_Host_file
ren %host1% %host2%
del C:\Windows\System32\drivers\etc\hosts
echo 10.61.10.27
mhpfs >>C:\Windows\System32\drivers\etc\hosts
echo 10.61.10.81
homail1 >>C:\Windows\System32\drivers\etc\hosts
echo 10.61.10.82
hofax1 >>C:\Windows\System32\drivers\etc\hosts
echo 10.61.20.81
mf12mail >>C:\Windows\System32\drivers\etc\hosts
echo 10.61.30.81
mf13mail >>C:\Windows\System32\drivers\etc\hosts
del /q %wdf%\SAP\Common
del /q %wcf%\SAP\Common
mkdir %wdf%\SAP\Common
mkdir %wcf%\SAP\Common
REM #Create_SAPUILandscape.xml_on_%temp%
Type Nul >"%TEMP%"\SAPUILandscape.xml
echo ^<^?xml version="1.0" encoding="utf-8"^?^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Landscape updated="2019-08-22T06:18:28Z" version="1" generator="SAP GUI for Windows v7600.1.2.149"^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Workspaces^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Workspace uuid="6a4d9ada-fe04-433e-8add-1d608fe40580" name="Local"^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Item uuid="9d6ad04b-e5ca-48ae-a37a-536cd51e7c3b" serviceid="a8f71781-ac36-49e7-a433-6b58797a27f2"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^<Item uuid="0d64788e-96e1-45e3-9cac-ff94c7c97a31" serviceid="edc1f359-df3f-4577-85ad-ade6abe44954"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^<Item uuid="e9cd0bc8-8f57-4d93-9201-7f8c4577de5e" serviceid="f6130feb-f311-4039-880e-c5aa71268a0c"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^</Workspace^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^</Workspaces^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Services^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Service type="SAPGUI" uuid="a8f71781-ac36-49e7-a433-6b58797a27f2" name="SAP .DEV" systemid="MH2" mode="1" server="10.30.2.104:3200" sncop="-1" sapcpg="8600" dcpg="8604" clocale="TH"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^<Service type="SAPGUI" uuid="5f11af05-d005-4d70-bae2-469daecf3441" name="SAP .RQA" systemid="MH2" mode="1" server="10.50.2.104:3200" sncop="-1" sapcpg="1100" dcpg="8604" clocale="TH"/^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Service type="SAPGUI" uuid="edc1f359-df3f-4577-85ad-ade6abe44954" name="SAP Production 2" systemid="MH2" mode="1" server="10.50.2.102:3200" sncop="-1" sapcpg="8600" dcpg="8604" clocale="TH"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^<Service type="SAPGUI" uuid="f6130feb-f311-4039-880e-c5aa71268a0c" name="SAP Production 1" systemid="MH2" msid="014d41e4-f609-4997-9889-e7da68091764" server="MHP" sncop="-1" sapcpg="8600" clocale="TH" dcpg="8604"/^> >>"%TEMP%"\SAPUILandscape.xml
echo ^</Services^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Messageservers^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^<Messageserver uuid="014d41e4-f609-4997-9889-e7da68091764" name="MH2" host="10.50.2.102"/^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^</Messageservers^>
>>"%TEMP%"\SAPUILandscape.xml
echo ^</Landscape^>
>>"%TEMP%"\SAPUILandscape.xml
REM #Create_SAPUILandscapeGlobal_on_%temp%
Type Nul >"%TEMP%"\SAPUILandscapeGlobal.xml
echo ^<^?xml version="1.0" encoding="utf-8"^?^>
>>"%TEMP%"\SAPUILandscapeGlobal.xml
echo ^<Landscape^>
>>"%TEMP%"\SAPUILandscapeGlobal.xml
echo ^<Messageservers/^>
>>"%TEMP%"\SAPUILandscapeGlobal.xml
echo ^</Landscape^>
>>"%TEMP%"\SAPUILandscapeGlobal.xml
copy /y "%TEMP%"\SAPUILandscape.xml %wcf%\SAP\Common
copy /y "%TEMP%"\SAPUILandscape.xml %wdf%\SAP\Common
copy /y "%TEMP%"\SAPUILandscapeGlobal.xml %wcf%\SAP\Common
copy /y "%TEMP%"\SAPUILandscapeGlobal.xml %wdf%\SAP\Common
REM #Create_Script_ResetPritner
REM
echo. >c:\Reset_Printer.cmd
REM
echo net stop "print spooler" >>C:\Reset_Printer.cmd
REM
echo Del C:\WINDOWS\system32\spool\PRINTERS\*.* /q >>C:\Reset_Printer.cmd
REM
echo net start "print spooler" >>C:\Reset_Printer.cmd
REM
echo exit >>C:\Reset_Printer.cmd
REM #Create_Shortcut_Printer
REM echo [InternetShortcut] >> "%PUBLIC%\desktop\Reset_Printer.url"
REM echo URL="C:\Reset_Printer.cmd" >> "%PUBLIC%\desktop\Reset_Printer.url"
REM echo IconFile=C:\WINDOWS\system32\SHELL32.dll >> "%PUBLIC%\desktop\Reset_Printer.url"
REM echo IconIndex=222 >> "%PUBLIC%\desktop\Reset_Printer.url"
REM #Create_Shortcut_SAP
REM
copy /y "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\SAP Front End\SAP Logon.lnk" "%PUBLIC%\desktop\"
REM #SAP_GUI
REG ADD "HKCU\Software\SAP\General\Appearance" /v "SelectedTheme"
/t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\SAP\General\Appearance" /v "CorbuIcon"
/t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\SAP\General\Appearance" /v "ShowShadowBorder" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\SAP\General\Appearance" /v "Sound"
/t REG_SZ /d "off" /f
REG ADD "HKLM\Software\Wow6432Node\SAP\SAPLogon" /v "ShowExplorerView" /t REG_DWORD /d 0 /f
REG ADD "HKLM\Software\Wow6432Node\SAP\SAPLogon" /v "ShowTreeView"
/t REG_DWORD /d 0 /f
REG ADD "HKLM\Software\Wow6432Node\SAP\SAPLogon" /v "ShowWorkspaceView" /t REG_DWORD /d 0 /f
REG ADD "HKLM\Software\Wow6432Node\SAP\General\Appearance\Themes" /v "SelectableThemes" /t REG_DWORD /d 1 /f
echo.
echo.
echo.
Echo Please Run Script 2 Times Admin_Normal mode
echo.
echo.
pause > Nul