Ok, so where you've changed the whole thing, I've gotten lost on what's what, sorry!
The idea was to have a single place to change the path to the Target directories. Should I decide to move them, I can just change one line.
Also, having each junction on a separate line is much easier to read and edit, as it was before, can it be done that way instead please.![Rose Gift :rosegift:]()
Having a single line for a hundred Junctions makes my eyes go fuzzy!![Shocked O.O]()
Can I just combine them to do this:But do the double quotes around both the $path variable and the Target cause a conflict?
- $path = "C:\Path\To\Junctions" - Understand this...
- $junctions = @("C:\Target\Folder1", "C:\Target\Folder2") - I get this, but aren't I having to specify the entire path for each Junction and Target? Is the C: part necessary here? I was assuming something like:
$junctions = @("$path\Target\Folder1", "$path\Target\Folder2")
- $junctionPath = "$path\$([System.IO.Path]::GetFileName($junction))" - This basically puts the $path variable in the actual Junction path. I was looking to add the $path variable to the Target path.
The idea was to have a single place to change the path to the Target directories. Should I decide to move them, I can just change one line.
Also, having each junction on a separate line is much easier to read and edit, as it was before, can it be done that way instead please.

Having a single line for a hundred Junctions makes my eyes go fuzzy!

Can I just combine them to do this:
Code:
$path = "D:\Path\To\Target"$junctions = @{ "C:\Path\To\Junction1" = "$path\Target\Folder1" "C:\Path\To\Junction2" = "$path\Target\Folder2"}foreach ($junction in $junctions.GetEnumerator()) { New-Item -ItemType Junction -Path "$($junction.Key)" -Target "$($junction.Value)"}
Statistics: Posted by sl23 — Today, 9:52 am