0
我創建了一個簡單的批處理文件,用於將連接模式更改爲無線連接到局域網,反之亦然(我們公司有時與我們的Internet連接有困難,並會建議我們更改連接)。CMD選擇查詢
下面是代碼(我只是在腳本一個新手):
@ECHO off
cls
:start
ECHO.
ECHO *********************************************
ECHO Choose Connection Mode (!!!Case Sensitive!!!)
ECHO *********************************************
ECHO.
ECHO [W]ireless Mode On
ECHO [L]ocal Area Connection Mode On
ECHO [E]xit
ECHO.
set choice=
set /p choice=Select Connection Mode:
ECHO.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='W' goto wireless
if '%choice%'=='L' goto local
if '%choice%'=='E' goto end
ECHO "%choice%" is not valid, try again
ECHO.
goto start
:wireless
netsh interface set interface "Local Area Connection" DISABLED
netsh interface set interface "Wireless Network Connection" ENABLED
ECHO.
goto end
:local
netsh interface set interface "Wireless Network Connection" DISABLED
netsh interface set interface "Local Area Connection" ENABLED
goto end
:end
能有人請解釋這條線?
if not '%choice%'=='' set choice=%choice:~0,1%
我複製並編輯了我找到的腳本。只需要知道這部分以便更好地理解
Got it!非常感謝你! – 7thGen
您可能想要考慮修改此選項以使用['CHOICE'](https://ss64.com/nt/choice.html)命令,該命令也在SS64中記錄。 –