Welcome to ciysys blog

Trigger an URL without waiting for its result

Published on: 23th Dec 2019

Updated on: 16th Jan 2022

Explanation

To trigger an URL, you simply execute the following command (curl is alias of Invoke-WebRequest):

curl "http://localhost:62037/run_proc.aspx"

If the page requires a longer time to complete, then, this command will block other processes. To avoid it, we use Start-Job command to execute the curl command:

Start-Job -Name curlJob99 -ScriptBlock { curl "http://localhost:62037/run_proc.aspx" }

To view the job status, run the following command:

Get-Job

Notes: the job is running in your current "session" - meaning, if you open another Powershell console, Get-Job will return an empty result.

Jump to #POWERSHELL blog

Author

Lau Hon Wan, software developer.