C# 用于检查进程是否存在的批处理脚本在名称中包含点时不起作用

C# 用于检查进程是否存在的批处理脚本在名称中包含点时不起作用,c#,shell,batch-file,C#,Shell,Batch File,上述代码不起作用。但是,如果我们将进程名命名为imagename eq notepad.exe,则可以正常工作 需要帮助。问题似乎不是点,而是文件名长度: 任务列表为我提供Dummy.Platform.Crashing.e而不是Dummy.Platform.Crashing.exe和 @echo off tasklist /nh /fi "imagename eq Dummy.Platform.Crashing.exe" | find /i "Dummy.Platform.Crashi

上述代码不起作用。但是,如果我们将进程名命名为
imagename eq notepad.exe
,则可以正常工作


需要帮助。

问题似乎不是点,而是文件名长度:

任务列表为我提供Dummy.Platform.Crashing.e而不是Dummy.Platform.Crashing.exe和

@echo off

 tasklist /nh /fi "imagename eq Dummy.Platform.Crashing.exe"  | 

find /i "Dummy.Platform.Crashing.exe" >nul &&

 (
 echo Crashed is running
 ) ||
 (
echo Crashed is not running
 )

 pause>nul
很好

可能将/nh替换为/FO列表:

tasklist /nh /fi "imagename eq Dummy.Platform.Crashing.exe"  | find /i "Dummy.Platform.Crashing.e"

谢谢Klein,它很长,
tasklist /FO LIST /fi "imagename eq Dummy.Platform.Crashing.exe"  | find /i "Dummy.Platform.Crashing.exe"