WshShell.AppActivate doesn't seem to work in simple vbs script

后端 未结 5 1017
谎友^
谎友^ 2020-12-19 00:58

total vbs scripting newb here. I\'m trying to automate closing a certain open window, namely a program called HostsMan. This is on Windows 8.1 Pro 64 bit, and this is what m

5条回答
  •  Happy的楠姐
    2020-12-19 01:09

    The key here is to put a small pause after the 'run' command but before the 'appactivate' command so the application shows up in the process list.

         WshShell.Run "calc"
         WScript.Sleep 100
         WshShell.AppActivate "Calculator"
    

提交回复
热议问题