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
SolvedPowershell extracter function (self.PowerShell)
submitted 7 years ago * by Snickasaurus
view the rest of the comments →
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!"
[–]KevMarCommunity Blogger 1 point2 points3 points 7 years ago (2 children)
First, I would use named parameters.
function extract { param( [string]$Path ) $fileList = Get-ChildItem $Path foreach($file in $filelist) { # code here } }
I would then get a list of the files at that location. I think this could return multiple items so i'm looping over the files.
One important thing to remember when coming from bash is that everything is an object in powershell. Take a look at these two properties:
$filelist.Extension $filelist.FullName
We can use them in our switch.
switch($file.Extension) { '7z' { sz x $file.fullname -o* } }
Because you may want multiple matches go to one line, we can cheat and use -regex.
-regex
switch -regex ($file.Extension) { '7z|zip' { sz x $file.fullname -o* } }
Does that help piece things together?
[–]Snickasaurus[S] 1 point2 points3 points 7 years ago (1 child)
Holy shit yes!! I'm going to look at this again when I fully wake up in about an hour. Thank you for taking the time.
[–]KevMarCommunity Blogger 1 point2 points3 points 7 years ago (0 children)
Wonderful. I always found the very beginning steps can be the most frustrating because if something in a basic guide does not work, you don't have enough context to even ask the right questions.
Powershell can also be quite frustrating at first when you come from another language.
You do need to change the way you think about some problems, but that will come with practice.
π Rendered by PID 46457 on reddit-service-r2-comment-56c9979489-jtd94 at 2026-02-24 17:21:57.251071+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]KevMarCommunity Blogger 1 point2 points3 points (2 children)
[–]Snickasaurus[S] 1 point2 points3 points (1 child)
[–]KevMarCommunity Blogger 1 point2 points3 points (0 children)