批处理进程未运行Windows Server 2008

时间:2013-10-23 20:13:14

标签: batch-file windows-server-2008 batch-processing

我正在尝试设置一个每小时运行一次的任务,该任务将执行批处理文件。当手动测试它似乎运行但不执行我期望的过程。我正在测试它打开mstsc.exe,我得到控制台消息,并打开一个新的控制台窗口显示该目录。不应该打开实际的RDesktop窗口。

@echo off 
tasklist /FI "IMAGENAME eq PRODUCER_69.exe" | find /I "PRODUCER_69.exe">nul &&(
echo PROCESS PRODUCER_69.exe IS ALREADY RUNNING! 
echo %DATE%
echo %TIME%
) || (
echo PRODUCER_69.exe IS NOT RUNNING! STARTING THE NEW PROCESS!
cmd /c start "C:\Windows\System32\mstsc.exe"
)
pause>nul
exit

1 个答案:

答案 0 :(得分:1)

oK我想我可能已经发现了我的错误......以下现在有效......

@echo off 
 tasklist /FI "IMAGENAME eq PRODUCER_69.exe" | find /I "PRODUCER_69.exe">nul &&(
 echo PROCESS PRODUCER_69.exe IS ALREADY RUNNING! 
 echo %DATE%
 echo %TIME%
  ) || (
 echo PRODUCER_69.exe IS NOT RUNNING! STARTING THE NEW PROCESS!
 cmd /c start "REMOTE DESKTOP" "C:\Windows\System32\mstsc.exe"
  )