Does silk recognize console windows with a caption other than "C:Windows\system32\cmd.exe"?

Silk 18.5

I need Silk to open cmd as an Administrator and enter a command to disable a network connection. The easiest way I found to do this was to create a scheduled task to simply open cmd as admin to avoid the UAC prompt (Silk doesn't like it) and enter the command. The console window opens like I want it to and brings it to focus, but it doesn't type anything. Any suggestions?


CommLoss(STRING sAdapter)
  SYS_Execute("schtasks /Run /TN CMDAdmin")
  Console.TypeKeysInWindow("wmic path win32_networkadapter where NetConnectionID={sAdapter} call disable<Enter>", "Administrator: taskeng.exe")


I really appreciate the help!

  • Why use silk for this at all? Task Scheduler should be able to do all of it, you can also have the command in a batch file or even a powershell script.
  • In reply to roma:

    I'm automating a manual test case and the steps require a comm loss/comm restore to a device and unfortunately, I have to write the script using silk. Creating a batch file might be acceptable. Thank you!
  • Hi Mandyy

    Which Silk Test client are you using? Silk Test Classic? I see in your example that you are already using the SYS_Execute() function.

    If you just need to run a command line, why don't you just use SYS_Execute() for that?

    e.g SYS_Execute("wmic path win32_networkadapter where NetConnectionID={sAdapter} call disable")

    This will simply execute the desired command line on the host machine.