大佬教程收集整理的这篇文章主要介绍了我将如何隔离或仅将第二个元素存储在批处理文件内的 for 循环中?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 windows 批处理文件中使用循环来返回 PID 编号,而我只想使用第二个 PID 编号。如何将第二个元素、第二个 PID 编号设置为变量或仅在循环中的命令中使用它而不是 @Singleton
public class serviceImpl implements service {
private ApplicationContext applicationContext;
public serviceImpl(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@OverrIDe
public Department save(String Name) {
return this.save(name,"default");
}
public Department save(String name,String targetDatasourcE) {
return this.applicationContext.getBean(DepartmentRepository.class,QualifIErs.byname(target)).save(Name);
}
}
?
代码..
echo
我尝试像 for /f "tokens=2 delims=," %%a in ('taskList /FO CSV ^| findstr /I cmd.exe') do (
echo PID:%%a
)
这样的元素建立索引。它没有用。
也许你想要这样的代码?
@echo off
SetLocal EnableDelayedExpansion
@for /f "tokens=2 delims=," %%a in ('tasklist /FO CSV ^| findstr /I cmd.exe') do (
set /A count+=1
Set "PID[!count!]=%%~a"
)
@For /L %%i in (1,1,%count%) do echo PID[%%i] = !PID[%%i]!
echo( I want this PID = !PID[2]!
pause
以上是大佬教程为你收集整理的我将如何隔离或仅将第二个元素存储在批处理文件内的 for 循环中?全部内容,希望文章能够帮你解决我将如何隔离或仅将第二个元素存储在批处理文件内的 for 循环中?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。