Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

I struggled with this and found many overly complicated posts.

It was hard to debug since I couldn't use "write-host" as it was a background job, so I used notepad to test like so:

Note: open a notepad "untitled document" and then watch PowerShell type in variable

function Do-StartJobWithArgs {
    Start-Job -ScriptBlock {
     Sleep 1
     $wshell = New-Object -ComObject
     $wshell.AppActivate("Untitled - Notepad")
     sleep 1
     sleep 1
    } -ArgumentList @($ArgVal)
$ArgVal = "TESTING"
  • No labels