Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
looking for a critique on "function Get-SpecialFolderInfo"
Post Body

howdy y'all,

got curious about "Special Folders" and decided to write a function to grab the info. so, it works, but i have a few questions [not counting the placeholder CBH [grin]] ...

[1] what did i leave out/do wrong/do less than optimally?

[2] should i deal with using both the switches?
right now it takes both and only responds to the 1st in the switch block. i suspect i otta make them exclusive somehow.
[decided to go with a three-value selector instead of two switches.]

[3] is there any graceful way to return only the user items?
checking for the username won't always work. i redirected my docs & music to D:\Data\*, so that won't do the job for my setup.


[4] should i short-circuit the $WhatToReturn decision?
the current switch is very clear, but it requires building the $TempObject for each item. that could be sidestepped for NameOnly & PathOnly by returning that info instead building the $TempObject.
i don't think it would save enuf time to make it worth the lessened clarity, tho. [frown]


original version ...
[PowerShell] function Get-SpecialFolderInfo - 2018.01.19.18.48.11 - Pastebin.com
— https://pastebin.com/XZC0BXWJ

current version ...
[PowerShell] function Get-SpecialFolderInfo - 2018.01.20.15.54.11 - Pastebin.com
— https://pastebin.com/UXn6fPrZ

take care,
lee

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
27,226
Link Karma
672
Comment Karma
25,727
Profile updated: 3 days ago
Posts updated: 8 months ago
[grin]

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago