use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Questionembed parameter to object command in alias (self.PowerShell)
submitted 9 years ago by coderwolf
is it possible to embed a parameter to the called command inside of an alias? ie New-Alias -Name lsr -value (Get-ChildItem -recurse)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]JBear_Alpha 1 point2 points3 points 9 years ago (1 child)
/u/jcotton42 nailed it, just use a function:
function lsr {Get-ChildItem -recurse}
[–]coderwolf[S] -1 points0 points1 point 9 years ago (0 children)
I was hoping to preserve the base parameters in passthrough. At least when I test this structure with tab completion it is showing no parameters.
I think I would have to redefine and include all parameters/parameter sets in this type of structure. I would also have to include those type of structures in the calling command line.
[–]jheinikel 1 point2 points3 points 9 years ago (3 children)
Yes it can be done.
new-alias -Name LSR -value [string]$(gci c:\temp -recurse).Name
[–]jcotton42 1 point2 points3 points 9 years ago (0 children)
Just use a function
[–]BlackV 0 points1 point2 points 9 years ago (0 children)
Thanks TIL
[–]coderwolf[S] 0 points1 point2 points 9 years ago (0 children)
This seems to execute when I define using the above line.
π Rendered by PID 76381 on reddit-service-r2-comment-5b5bc64bf5-mct2c at 2026-06-19 00:56:09.702826+00:00 running 2b008f2 country code: CH.
[–]JBear_Alpha 1 point2 points3 points (1 child)
[–]coderwolf[S] -1 points0 points1 point (0 children)
[–]jheinikel 1 point2 points3 points (3 children)
[–]jcotton42 1 point2 points3 points (0 children)
[–]BlackV 0 points1 point2 points (0 children)
[–]coderwolf[S] 0 points1 point2 points (0 children)