改成后台启动telnet.exe:start telnet.exe rem batch telnet cscript //nologo telnet.vbs
时间: 2024-06-04 18:05:07 浏览: 19
这段代码是一个批处理文件,其中包含两行命令,第一行是注释,第二行是启动 telnet.exe 的命令。第二行命令的作用是启动一个名为 telnet.exe 的程序。第三行命令是使用 VBScript 脚本语言来执行 telnet 命令,其中 //nologo 表示不输出 VBScript 的 logo。
如果您想要将这个批处理文件改成后台启动 telnet.exe,可以将第二行命令改为:
start /b telnet.exe
其中 start /b 命令可以在后台启动一个程序,不会弹出命令行窗口。
相关问题
@echo off rem 开启telnet服务 net start Telnet echo Telnet服务已启动 @echo off for /F "delims=" %%i in (ip_list.txt) do ( echo %%i start telnet.exe %%i ping /n 7 127.0.0.1 > nul tasklist|findstr /i "telnet.exe" > nul if ERRORLEVEL 1 (echo %%i>result.txt) else (taskkill /F /T /IM telnet.exe) ) 把他俩拼接到一起
当您将这两段代码拼接在一起时,请确保只保留一个`@echo off`指令,以及在其中适当的位置添加空行分隔它们。以下是拼接后的代码:
```
@echo off
rem 开启telnet服务
net start Telnet
echo Telnet服务已启动
rem 执行telnet连接
for /F "delims=" %%i in (ip_list.txt) do (
echo %%i
start telnet.exe %%i
ping /n 7 127.0.0.1 > nul
tasklist|findstr /i "telnet.exe" > nul
if ERRORLEVEL 1 (echo %%i>result.txt) else (taskkill /F /T /IM telnet.exe)
)
```
这段代码首先启动telnet服务,然后执行telnet连接的循环操作。它会从`ip_list.txt`文件中读取IP地址,逐个尝试telnet连接。如果telnet连接成功,则会在命令行输出IP地址;如果连接失败,则将IP地址写入`result.txt`文件;如果连接成功但无法退出telnet会话,则通过任务管理器强制终止telnet进程。
再把这一段拼接进去 @echo off for /F "delims=" %%i in (ip_list.txt) do ( echo %%i start telnet.exe %%i ping /n 7 127.0.0.1 > nul tasklist|findstr /i "telnet.exe" > nul if ERRORLEVEL 1 (echo %%i>result.txt) else (taskkill /F /T /IM telnet.exe) )
当将这三段代码拼接在一起时,请确保只保留一个`@echo off`指令,并在它们之间适当添加空行。以下是拼接后的代码:
```bat
@echo off
rem 开启telnet服务
net start Telnet
echo Telnet服务已启动
rem 执行telnet连接
for /F "delims=" %%i in (ip_list.txt) do (
echo %%i
start telnet.exe %%i
ping /n 7 127.0.0.1 > nul
tasklist|findstr /i "telnet.exe" > nul
if ERRORLEVEL 1 (echo %%i>result.txt) else (taskkill /F /T /IM telnet.exe)
)
rem 另一个段落
for /F "delims=" %%i in (ip_list.txt) do (
echo %%i
start telnet.exe %%i
ping /n 7 127.0.0.1 > nul
tasklist|findstr /i "telnet.exe" > nul
if ERRORLEVEL 1 (echo %%i>result.txt) else (taskkill /F /T /IM telnet.exe)
)
```
上述代码包含三个段落:开启telnet服务、执行telnet连接和另一个段落。请根据您的需求将`ip_list.txt`文件的路径正确设置在两个循环中。每个循环将逐个尝试telnet连接,并根据连接结果执行相应的操作。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)