CMD模板

Rule_hsh發表於2024-07-03

@echo off
color 09
title 開啟網路中心控制皮膚 %視窗標題%
@echo -------------------------------------------
@echo -------------------------------------------
@echo -------------------------------------------
@echo --------------這裡可以寫中文-------------
@echo -------------------------------------------
@echo -------------------------------------------
@echo -------------------------------------------

@echo 正在開啟 網路中心 控制皮膚...
pause
netplwiz


--------------------有選擇的模板----·-------------------
@echo 
:: H
:: 
:: Last updated on 2024/06/11

@echo off
%獲取管理員許可權中%
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
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"
color 2
title Install 關閉防火牆 %視窗標題%

:: NetSh Advfirewall set allprofiles state off  #關閉防火牆
:: NetSh Advfirewall set allprofiles state on  #開啟防火牆
:: Netsh Advfirewall show allprofiles            #檢視防火牆狀態

:menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 歡迎使用H之塵指令碼
echo.
echo 請選擇專案(關閉、開啟防火牆): 
echo.&echo 【1】關閉防火牆
echo.&echo 【2】開啟防火牆
echo.&echo 【3】檢視防火牆
echo.&echo 【4】高階防火牆
echo.&echo 【5】退出
:: echo.

set user_input=""
set /p user_input=請輸入數字:
if %user_input% equ 1 goto OFFFHQ
if %user_input% equ 2 goto ONFHQ
if %user_input% equ 3 goto ZTFHQ
if %user_input% equ 4 goto GJFHQ
if %user_input% equ 5 goto Quit
echo 輸入錯誤, 請重新輸入數字.
pause
goto menu

:OFFFHQ
NetSh Advfirewall set allprofiles state off 
pause
goto menu

:ONFHQ
NetSh Advfirewall set allprofiles state on
pause
goto menu

:ZTFHQ
Firewall.cpl
pause
goto menu

:GJFHQ
WF.msc
pause
goto menu

:Quit
exit

pause


:: XXXXXXXXX
:: XXXXXXXXXXXXXXXXXX
:: Last updated on 2024/07/11
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~分割線~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

相關文章