The following example sends the command Get-Date to an existing PowerShell window:
-
Activate the PowerShell window using AppActivate.
-
Wait briefly to ensure the window receives focus.
-
Send: "Get-Date"
-
Send: {ENTER}
The command executes in the existing PowerShell session and returns the current date and time.
Code Snippet Disclaimer: The following code snippet is provided as an example implementation and may require modification for a specific application.
The following screenshot shows the command successfully executing in the target PowerShell window.
In the screenshot, the Get-Date command is sent from LabVIEW and executed in the existing PowerShell session, returning the current system date and time.