I'm trying to create a program that will open "command prompt" and open a specific port using "sendKeys". Here is my code:
Set Keys = CreateObject("WScript.Shell")
oShell.ShellExecute "cmd.exe","runas", 1
Sleep(0.01)
Keys.sendKeys "{ENTER}"
Sleep(0.01)
Keys.sendKeys "rem Open TCP Port 407 inbound and outbound"
Keys.sendKeys "{ENTER}"
Keys.sendKeys "netsh advfirewall firewall add rule name=""EXAMPLE"" dir=out action=allow protocol=TCP localport=407"
Keys.sendKeys "{ENTER}"
Keys.sendKeys "netsh advfirewall firewall add rule name=""EXAMPLE"" protocol=TCP dir=out localport=407 action=""allow"""
Keys.sendKeys "{ENTER}"
I think that the keys are not fast enough.
I don't want to use Keys.run "cmd [code]"
because then an Antivirus might think that the program is a virus.