$exist = 0
$oWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
$oProcesses = $oWMI.ExecQuery("SELECT * FROM Win32_Process", "WQL", 0x30)
For $oProcess In $oProcesses
If ($oProcess.Name = "Notepad.exe" And StringInStr($oProcess.CommandLine, "C:\test.txt")) Then $exist = 1
Next
MsgBox(64+262144, Default, "Process " & ($exist?"already":"not") & " running.",0)