@echo off rem 2017 (c) izoka rem 2017_0214 1st rem 2017_0220 起動先の処理に関わらず次の選択が出来る様に変更 rem 2017_0221 起動項目の追加 title win_setting :main_loop echo 起動する機能 echo; echo 0:設定呼出cmdの終了 echo 1:再起動 echo 2:デバイスマネージャを起動 echo 3:コンピュータの管理を起動 echo 4:コマンドプロンプトを起動 echo 5:msinfoを起動 echo 6:msconfig(システム構成)を起動 echo 7:dxdiagを起動 echo 8:win update起動 echo 9:ネットワーク接続を起動 echo 10:インターネット オプションを起動 echo 11:プログラムの追加と削除を起動 echo 12:システムのプロパティを起動 echo 13:デフラグを起動 echo 14:クリーンアップを起動 echo 15:視覚効果/仮想メモリを起動 echo 16:電源オプションを起動 echo 17:サービスを起動 echo 18:サービス設定 echo 19:hibernate設定 echo 20:レジストリ起動 echo 21:イベントビューアーを起動 echo 22:タスクスケジューラを起動 echo; set /p select="起動する番号を入力してenter " echo =============================================================================== if "%select%"=="0" ( rem 設定呼出cmdの終了 exit /b; ) else if "%select%"=="1" ( rem 再起動 call :reboot ) else if "%select%"=="2" ( rem デバイスマネージャ start devmgmt.msc ) else if "%select%"=="3" ( rem コンピュータの管理 start compmgmt.msc /s ) else if "%select%"=="4" ( rem コマンドプロンプト start cmd.exe ) else if "%select%"=="5" ( rem システム情報 start msinfo32.exe ) else if "%select%"=="6" ( rem システム構成 start msconfig.exe ) else if "%select%"=="7" ( rem DirectX診断ツール start dxdiag.exe ) else if "%select%"=="8" ( rem win update wuapp.exe startmenu ) else if "%select%"=="9" ( rem ネットワーク接続 ncpa.cpl ) else if "%select%"=="10" ( rem インターネットオプション inetcpl.cpl ) else if "%select%"=="11" ( rem プログラムの追加と削除 appwiz.cpl ) else if "%select%"=="12" ( rem システムのプロパティ sysdm.cpl ) else if "%select%"=="13" ( rem デフラグ start dfrgui.exe ) else if "%select%"=="14" ( rem クリーンアップ start cleanmgr.exe ) else if "%select%"=="15" ( rem 視覚効果/仮想メモリ SystemPropertiesPerformance.exe ) else if "%select%"=="16" ( rem 電源オプション powercfg.cpl ) else if "%select%"=="17" ( rem サービス start services.msc ) else if "%select%"=="18" ( rem サービス設定 call :serv ) else if "%select%"=="19" ( rem hibernate設定 call :hibernate ) else if "%select%"=="20" ( rem レジストリエディタ起動 start regedit.exe ) else if "%select%"=="21" ( rem イベントビューア起動 start eventvwr.msc /s ) else if "%select%"=="22" ( rem タスクスケジューラ起動 start taskschd.msc /s ) else ( echo; ) goto :main_loop rem ----------sub-------------- :reboot set /p chk="再起動しますか? y/n? " if "%chk%"=="y" shutdown.exe -r -t 0 echo =============================================================================== exit /b :serv title サービス設定 echo サービスの設定をどのようにしますか? echo; echo 0 :変更しない(起動する機能選択に戻る)。 echo 1 :現在の設定を保存する。 echo 2 :以前の状態を読み込む。 echo 3 :初期値に戻す。 echo 4 :不要な物を無効にする。 echo; echo 4 を選んだ時に無効とするサービス。 echo Desktop Window Manager Session Manager(win7半透明化) echo Parental Controls(保護者機能) echo Tablet PC Input Service(ペンタッチ) echo TPM Base Sevices(指紋認証) echo Remote Registry(リモートによるレジストリ変更許可) echo; set /p select2="番号を入力してenter " if "%select2%"=="1" ( call :serv_export goto :serv ) else if "%select2%"=="2" ( call :serv_inport goto :serv ) else if "%select2%"=="3" ( call :serv_def goto :serv ) else if "%select2%"=="4" ( call :serv_dis goto :serv ) else ( echo =============================================================================== echo 変更は行いません。 echo =============================================================================== exit /b ) exit /b :serv_export title サービス起動設定をエクスポート echo 実行中...(実行中に中断しないで下さい) copy nul temp.txt rem サービスのステータス読取り for /F "tokens=*" %%i in ('sc query state^= all type^= service') do echo %%i|find "SERVICE_NAME">>temp.txt for /F "tokens=*" %%i in ('hostname') do set pcname=%%i rem 時間の空白を0置換 set time2=%time: =0% rem 保存ファイル名と1行目に[サービス起動設定]を書込み rem ファイルメ名に使えない/ : を除外 echo>service_%pcname%_%date:/=%_%time2:~,2%%time2:~3,2%.txt [サービス起動設定] rem 保存ファイルにサービスステータスを記録。 for /F "tokens=*" %%i in (temp.txt) do call :serv_export_sub "%%i" del temp.txt echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b :serv_export_sub set SERVICE_NAME=%~1 for /F "tokens=*" %%x in ('sc qc "%SERVICE_NAME:~14%"') do ( echo %%x|find "START_TYPE">nul if not errorlevel 1 set START_TYPE=%%x ) echo %SERVICE_NAME:~14% is %START_TYPE:~25% echo>>service_%pcname%_%date:/=%_%time2:~,2%%time2:~3,2%.txt %START_TYPE:~21,1%/%SERVICE_NAME:~14% rem 起動ステータスについて rem 2 AUTO_START rem 3 DEMAND_START rem 4 DISABLED exit /b :serv_inport title サービス起動設定をインポート echo =============================================================================== echo exportされたservice_wakeup.txtを同フォルダに置いてください。 rem カレントディレクトリをbatのあるフォルダに指定 cd /D %~dp0 :serv_inport_loop rem ファイル名の入力 echo =============================================================================== set /p target="読込むファイル名(拡張子不要)を入力。cancelで終了。" if "%target%"=="cancel" ( echo =============================================================================== goto serv ) rem ファイルの探索と[サービス起動設定]の検証 find "[サービス起動設定]" "%target%".txt>nul rem 該当しない場合 if errorlevel 1 ( echo ファイルが指定されなかったか、無効なファイルです。 echo; rem 再帰 goto :serv_inport_loop ) rem サービス設定の反映 for /F "skip=1 tokens=*" %%i in (%target%.txt) do call :serv_inport_sub "%%i" echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b :serv_inport_sub @echo on set LINE=%~1 if "%LINE:~0,1%"=="2" sc config "%LINE:~2%" start= auto if "%LINE:~0,1%"=="3" sc config "%LINE:~2%" start= demand if "%LINE:~0,1%"=="4" sc config "%LINE:~2%" start= disabled @echo off exit /b :serv_def title サービスの初期化 echo =============================================================================== @echo on sc config AeLookupSvc start= DEMAND sc config ALG start= DEMAND sc config AppIDSvc start= DEMAND sc config Appinfo start= DEMAND sc config AppMgmt start= DEMAND sc config AudioEndpointBuilder start= AUTO sc config Audiosrv start= AUTO sc config AxInstSV start= DEMAND sc config BDESVC start= DEMAND sc config BFE start= AUTO sc config BITS start= AUTO sc config Browser start= DEMAND sc config bthserv start= DEMAND sc config CertPropSvc start= DEMAND sc config clr_optimization_v2.0.50727_32 start= AUTO sc config COMSysApp start= DEMAND sc config CryptSvc start= AUTO sc config CscService start= AUTO sc config DcomLaunch start= AUTO sc config defragsvc start= DEMAND sc config Dhcp start= AUTO sc config Dnscache start= AUTO sc config dot3svc start= DEMAND sc config DPS start= AUTO sc config EapHost start= DEMAND sc config EFS start= DEMAND sc config ehRecvr start= DEMAND sc config ehSched start= DEMAND sc config eventlog start= AUTO sc config EventSystem start= AUTO sc config Fax start= DEMAND sc config fdPHost start= DEMAND sc config FDResPub start= AUTO sc config FontCache start= DEMAND sc config FontCache3.0.0.0 start= DEMAND sc config gpsvc start= AUTO sc config hidserv start= DEMAND sc config hkmsvc start= DEMAND sc config HomeGroupListener start= DEMAND sc config HomeGroupProvider start= DEMAND sc config idsvc start= DEMAND sc config IKEEXT start= DEMAND sc config IPBusEnum start= DEMAND sc config iphlpsvc start= AUTO sc config KeyIso start= DEMAND sc config KtmRm start= DEMAND sc config LanmanServer start= AUTO sc config LanmanWorkstation start= AUTO sc config lltdsvc start= DEMAND sc config lmhosts start= AUTO sc config Mcx2Svc start= DISABLED sc config MMCSS start= AUTO sc config MpsSvc start= AUTO sc config MSDTC start= DEMAND sc config MSiSCSI start= DEMAND sc config msiserver start= DEMAND sc config napagent start= DEMAND sc config Netlogon start= DEMAND sc config Netman start= DEMAND sc config netprofm start= DEMAND sc config NetTcpPortSharing start= DISABLED sc config NlaSvc start= AUTO sc config nsi start= AUTO sc config p2pimsvc start= DEMAND sc config p2psvc start= DEMAND sc config PcaSvc start= DEMAND sc config PeerDistSvc start= DEMAND sc config pla start= DEMAND sc config PlugPlay start= AUTO sc config PNRPAutoReg start= DEMAND sc config PNRPsvc start= DEMAND sc config PolicyAgent start= DEMAND sc config Power start= AUTO sc config ProfSvc start= AUTO sc config ProtectedStorage start= DEMAND sc config QWAVE start= DEMAND sc config RasAuto start= DEMAND sc config RasMan start= DEMAND sc config RemoteAccess start= DISABLED sc config RemoteRegistry start= DEMAND sc config RpcEptMapper start= AUTO sc config RpcLocator start= DEMAND sc config RpcSs start= AUTO sc config SamSs start= AUTO sc config SCardSvr start= DEMAND sc config Schedule start= AUTO sc config SCPolicySvc start= DEMAND sc config SDRSVC start= DEMAND sc config seclogon start= DEMAND sc config SENS start= AUTO sc config SensrSvc start= DEMAND sc config SessionEnv start= DEMAND sc config SharedAccess start= DISABLED sc config ShellHWDetection start= AUTO sc config SNMPTRAP start= DEMAND sc config Spooler start= AUTO sc config sppsvc start= AUTO sc config sppuinotify start= DEMAND sc config SSDPSRV start= DEMAND sc config SstpSvc start= DEMAND sc config StiSvc start= DEMAND sc config swprv start= DEMAND sc config SysMain start= AUTO sc config TabletInputService start= DEMAND sc config TapiSrv start= DEMAND sc config TBS start= DEMAND sc config TermService start= DEMAND sc config Themes start= AUTO sc config THREADORDER start= DEMAND sc config TrkWks start= AUTO sc config TrustedInstaller start= DEMAND sc config UI0Detect start= DEMAND sc config UmRdpService start= DEMAND sc config upnphost start= DEMAND sc config UxSms start= AUTO sc config VaultSvc start= DEMAND sc config vds start= DEMAND sc config VSS start= DEMAND sc config W32Time start= DISABLED sc config wbengine start= DEMAND sc config WbioSrvc start= DEMAND sc config wcncsvc start= DEMAND sc config WcsPlugInService start= DEMAND sc config WdiServiceHost start= DEMAND sc config WdiSystemHost start= DEMAND sc config WebClient start= DEMAND sc config Wecsvc start= DEMAND sc config wercplsupport start= DEMAND sc config WerSvc start= DEMAND sc config WinDefend start= AUTO sc config WinHttpAutoProxySvc start= DEMAND sc config Winmgmt start= AUTO sc config WinRM start= DEMAND sc config Wlansvc start= DEMAND sc config wmiApSrv start= DEMAND sc config WMPNetworkSvc start= DEMAND sc config WPCSvc start= DEMAND sc config WPDBusEnum start= DEMAND sc config wscsvc start= AUTO sc config WSearch start= DISABLED sc config wuauserv start= AUTO sc config wudfsvc start= DEMAND sc config WwanSvc start= DEMAND @echo off echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b :serv_dis title 不要サービスの無効化 echo =============================================================================== @echo on sc config UxSms start= DISABLED sc config WPCSvc start= DISABLED sc config TabletInputService start= DISABLED sc config TBS start= DISABLED sc config RemoteRegistry start= DISABLED @echo off echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b :hibernate title hibernate設定 echo hibernateをどのようにしますか? echo 現在の設定は echo =============================================================================== powercfg /a echo; echo =============================================================================== echo です。 echo; echo 0 :変更しない(起動する機能選択に戻る)。 echo 1 :有効にする。 echo 2 :無効にする。 echo; set /p select1="番号を入力してenter。" if "%select1%"=="1" ( call :hibernate_on ) else if "%select1%"=="2" ( call :hibernate_off ) else ( echo =============================================================================== echo 変更は行いません。 echo =============================================================================== ) exit /b :hibernate_on echo =============================================================================== @echo on powercfg /hibernate on @echo off powercfg /a echo; echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b :hibernate_off echo =============================================================================== @echo on powercfg /hibernate off @echo off powercfg /a echo; echo =============================================================================== echo 実行しました。 echo =============================================================================== exit /b exit