mardi 1 septembre 2015

Batch if statements based on opening a file

Is it possible to make an if statement for batch based off a user opening a file?

I tried this:

color c
echo off
cls

:props
if open WINWORD.exe (echo a & pause 10 & exit) 
goto props

Doing so will simply post the error 'WINWORD was unexpected at this time.' and kill the command prompt.

What I am trying to achieve is a batch file that will:

  1. Look if anyone is opening WINWORD.exe
  2. Once somebody has opened the file the command prompt will display 'a'
  3. Exit the command prompt after 10 seconds once 'a' was displayed.

Aucun commentaire:

Enregistrer un commentaire