I’m a couple days into this, so total noob. I’m trying to get a directory name via input from user and then name the folder with that variable and copy data to it.
$directory= Read-Host 'Enter Userid' | copy-item "C:\ProgramData\microsoft\windows\start menu\programs" -destination "c:\labs\backup\$directory\programs" -recurse
I can get both sides of the pipe to work alone, minus the variable in the 2nd part of course. Any one free to point out the reason this fails? and possibly offer and alternative?