Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

start-job

Powershell pass variable to start-job

November 24, 2023 by Tarik

To complement Keith Hill’s helpful answer with a PSv3+ alternative: The $using: scope modifier can be used to reference the values of variables in the caller’s scope inside the script block passed to Start-Job, as an alternative to passing arguments (by default, a script block executed as a background job does not see any of … Read more

Categories variables Tags powershell, start-job, variables Leave a comment

PowerShell Start-Job Working Directory

September 17, 2023 by Tarik

There is nice solution from comments section of some dude’s post. Commenter suggests to use Init parameter to setup working directory of script block. function start-jobhere([scriptblock]$block) { Start-Job -Init ([ScriptBlock]::Create(“Set-Location ‘$pwd'”)) -Script $block }

Categories powershell Tags powershell, start-job Leave a comment

Invoke a second script with arguments from a script

February 4, 2023 by Tarik

Aha. This turned out to be a simple problem of there being spaces in the path to the script. Changing the Invoke-Expression line to: Invoke-Expression “& `”$scriptPath`” $argumentList” …was enough to get it to kick off. Thanks to Neolisk for your help and feedback!

Categories powershell Tags command-line-arguments, invoke-command, parameter-passing, powershell, start-job Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa