:: 注释
rem @echo off
cd /d d:\\Redis
:: redis-cli
:: shutdown
:: exit
:: netstat -ano |findstr "6639"
:: taskkill /pid {pid} /F
redis-server redis.windows.conf
pause
cmd中替代grep的命令findstr
查看进程命令tastlist
杀死进程命令 taskkill /pid {pid} /F
@echo与echo
cmd查看环境变量
set 命令
set path 查看path变量值
bat脚本案例
杀死占用8888端口的进程
@echo off
set"port=8888"
REM 查找占用指定端口的进程
for /f "tokens=5" %%a in('netstat -a -n -o ^| findstr /r ":%port%"')do(set"pid=%%a")
REM 如果找到匹配的进程,杀死它
if defined pid (
taskkill /F /PID %pid%
echo Process with PID %pid% using port %port% has been terminated.
)else(echo No process found using port %port%.
)
杀死此目录下的.zip文件
@echo off
set"target_directory=C:\Your\Target\Directory" REM 替换为你的目标目录
cd /d "%target_directory%" REM 切换到目标目录
REM 删除所有 .zip 文件
for %%i in(*.zip)do(
del "%%i"echo Deleted "%%i")echo All .zip files in %target_directory% have been deleted.
《测试原则和方法》
测试原则 测试:为了发现错误而执行程序的过程成功的测试:发现了至今尚未发现的错误的测试 测试方法 静态测试(有效发现30%-70%的错误) a. (文档)检查单 b. (代码ÿ…
[python 刷题] 287 Find the Duplicate Number
题目: Given an array of integers nums containing n 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must sol…