Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Highlighted
Mandyy Absent Member.
Absent Member.
243 views

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!

0 Likes
3 Replies
roma1 Absent Member.
Absent Member.

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

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.
0 Likes
Mandyy Absent Member.
Absent Member.

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

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!
0 Likes
Micro Focus Expert
Micro Focus Expert

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

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.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.