techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

4.7K
active users

#pwsh

2 posts1 participant0 posts today

Hi #nerds, if I run a #powershell script that takes a directory or a collection of directories as its arguments, the trailing slash in the directory name turns the following single quote into a double quote using evil Microsoft dark magic somehow.
If my script is:
```
param (
[string[]]$inDirs
)
foreach ($dir in $inDirs){
write-host $dir
}
```
and I do
```
pwsh myscript.ps1 'c:\\some\dir\'
```
The result is
```
c:\\some\dir"
```
How do I get it to unescape (or whatever it's doing) the last slash?
#AskFedi #CodingHelp #pwsh

I ran into Matthew Dowst at #MVPSummit and he asked if I ever made a web form to easily submit new #PowerShell tips for my tiPS module like I planned. I sadly said no. Then I had some time to kill in my hotel... So you can now submit #pwsh tips via a GitHub issue! 😁

Try it out by opening a new issue on the repo at github.com/deadlydog/PowerShel. The issue will open a PR with the tip info you supplied in the issue. No need to fork the repo and manually create a file and PR anymore 💪

PowerShell Studio 5.9.254 has been released; Exceptions from the PowerShell Cachebuilder are now shown in the Tool Output panel after completion along with ScriptMerge adds options to determine how files are compared in folder compare.

Product version history:
👉 bit.ly/4hfKUBR