I'm creating a powershell script that will create a folder for a module in the PS modules folder, then download the module from github. I'm avoiding using the System32 folder, so generally I'd use the ProgramFiles folder, but not everyone has access to that, so the next one would be in the Documents folder for the user running the script. The problem is if that user changed their documents folder from the C drive to another drive, the script will fail, so I'd like to get a command that will take the first path as a string, before the semi colon, when executing
$env:psmodulepath
and use that string to further make module folders.
tl;dr: How do I capture a string starting from 0 up until a semi colon.
Thanks
[environment]::getfolderpath("mydocuments")
– user6811411