Skip to content

Add ArgumentLlist parameter to ScriptBlock and ScriptFile entries#96

Merged
mdgrs-mei merged 2 commits intomainfrom
add-argument-list-to-scripts
Jan 2, 2026
Merged

Add ArgumentLlist parameter to ScriptBlock and ScriptFile entries#96
mdgrs-mei merged 2 commits intomainfrom
add-argument-list-to-scripts

Conversation

@mdgrs-mei
Copy link
Owner

@mdgrs-mei mdgrs-mei commented Jan 2, 2026

This PR adds ArgumentList parameter to Add-PSRunScriptBlock and Add-PSRunScriptFile.

Let's say you have a ps1 file for PowerShellRun configuration that is called from your profile script:

# In your profile.ps1
# ...
& $PSScriptRoot/PSRunConfig.ps1
# ...

You can now store temporary variables into ArgumentList without exposing them to the global scope:

# PSRunConfig.ps1
Add-PSRunScriptBlock -ScriptBlock {
    param ($PSRunConfigPath)
    code $PSRunConfigPath
} -ArgumentList $MyInvocation.MyCommand.Path

@mdgrs-mei mdgrs-mei merged commit b8666e2 into main Jan 2, 2026
3 checks passed
@mdgrs-mei mdgrs-mei deleted the add-argument-list-to-scripts branch January 2, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant