项目中需要通过cmd脚本启动kafka服务,就学习并手写了cmd脚本;
set data_path=D:Softwarekafka_2.11-1.0.1Softwarekafka_2.11-1.0.1dataversion-2 set log_path=D:Softwarekafka_2.11-1.0.1Softwarekafka_2.11-1.0.1kafka-logs set kafka_path=D:Softwarekafka_2.11-1.0.1 D: rmdir %data_path% /S /Q rmdir %log_path% /S /Q cd %kafka_path% rem 启动kafka start cmd /k .inwindowszookeeper-server-start.bat .configzookeeper.properties start cmd /k .inwindowskafka-server-start.bat .configserver.properties
整体思路:设置变量,批量删除kafka日志文件,打开两个cmd窗口,启动zookeeper和kafka脚本;