標(biāo)題: telnet會(huì)話管理 [打印本頁(yè)]

作者: liumei    時(shí)間: 2014-4-26 14:01
標(biāo)題: telnet會(huì)話管理
@echo off

setlocal enabledelayedexpansion
color 1a
:again
cls
set num=
set endnum=
set message=
echo.
echo.
echo  telnet會(huì)話管理
echo  1.開啟telnet服務(wù)
echo  2.列出所有的telnet會(huì)話
echo  3.終止選定的telnet會(huì)話
echo  4.向指定telnet會(huì)話發(fā)信息
echo  5.向所有telnet會(huì)話發(fā)信息
echo  6.結(jié)束telnet服務(wù)
echo  7.退出程序
echo.
echo.
set /p num=請(qǐng)選擇要執(zhí)行的操作:
if "!num!"=="1" (
cls
echo.
echo.
sc config tlntsvr start= demand >nul
sc start tlntsvr >nul
net stop sharedaccess >nul
echo telnet服務(wù)已成功開啟,請(qǐng)返回繼續(xù)操作...
pause >nul
goto again
)
if "!num!"=="2" (
cls
tlntadmn -s
echo 請(qǐng)返回重新選擇...
pause >nul
goto again
)
if "!num!"=="3" (
cls
tlntadmn -s
tlntadmn -s | find "沒有"
if not errorlevel 1 (
echo 沒有建立telnet會(huì)話,請(qǐng)返回重新輸入...
pause >nul
goto again
)
:inptid
echo.
set /p endnum=請(qǐng)輸入要終止的telnet會(huì)話ID:
if "!endnum!"=="" (
echo telnet會(huì)話ID輸入無效,返回重新輸入...
goto inptid
)
tlntadmn -k !endnum!
echo.
echo 已成功終止制定的會(huì)話,請(qǐng)返回重新選擇...
pause >nul
goto again
)
if "!num!"=="4" (
cls
tlntadmn -s
tlntadmn -s | find "沒有"
if not errorlevel 1 (
echo 沒有建立telnet會(huì)話,請(qǐng)返回重新輸入...
pause >nul
goto again
)
:inptid2
echo.
set /p endnum=請(qǐng)輸入要發(fā)送信息的telnet會(huì)話ID:
if "!endnum!"=="" (
echo telnet會(huì)話ID輸入無效,返回重新輸入...
goto inptid2
)
echo.
set /p message=請(qǐng)輸入要發(fā)送信息:
tlntadmn -m !endnum! !message!
echo 信息已經(jīng)發(fā)送成功,請(qǐng)返回重新選擇...
pause >nul
goto again
)
if "!num!"=="5" (
cls
tlntadmn -s
tlntadmn -s | find "沒有"
if not errorlevel 1 (
echo 沒有建立telnet會(huì)話,請(qǐng)返回重新輸入...
pause >nul
goto again
)
echo.
set /p message=請(qǐng)輸入要發(fā)送信息:
tlntadmn -m all !message!
echo 信息發(fā)送成功,請(qǐng)返回重新選擇...
pause >nul
goto again
)

if "!num!"=="6" (
cls
echo.
echo.
sc config tlntsvr start= disabled >nul
sc stop tlntsvr >nul
net start sharedaccess >nul
echo telnet服務(wù)已成功終止,請(qǐng)返回繼續(xù)操作...
pause >nul
goto again
)
if "!num!"=="7" (
goto exit
)
:exit
set num=
set endnum=
set message=





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1