I am wondering why one method works but the other does not
Not sure what to try
1.
$syspinEXE = "Z:\syspin.exe"
$programDataPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
&$syspinEXE "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Word 2016.lnk" 5386
2.
$syspinEXE = "Z:\syspin.exe"
$programDataPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
&$syspinEXE "$programDataPath","Word 2016.lnk" -join "\" 5386
I am wondering why the first snippet works but the second snippet does not. I believe they should both work, but this is obviously not true.
"$programDataPath"and try again? :)"$programDataPath","Word 2016.lnk" -join "\"in parentheses, otherwise-joinand"\"will be interpreted as a parameter name and a separate argument to&( )causes the expression within them to be evaluated first before being passed to the command. (Otherwise, as noted, it will be seen as separate parameters.)