I have a script defining
$path = $env:APPDATA
$user = $env:USERNAME
and I’m backing up items in a user profile to a temp path in H: and then restoring them from H: back to the user profile.
Running this succesffuly, backs up my firefox profile path
Copy-item $pathMozillaFirefoxProfiles*.defaultbookmarkbackups -recurse -destination H:profileswitchfirefoxprofile
but running this does not restore it:
Copy-Item H:profileswitchfirefoxprofilebookmarkbackups -Recurse -Destination "$pathMozillaFirefoxProfiles*.defaultbookmarkbackups"
It’s telling me this:
Copy-Item : Illegal characters in path. At C:Scriptsprofileswitch.ps1:17 char:10 + Copy-Item <<<< H:profileswitchfirefoxprofilebookmarkbackups -Recurse -Destination "C:USers$userMozillaFirefo xProfiles*.defaultbookmarkbackups" + CategoryInfo : NotSpecified: (:) [Copy-Item], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.CopyItemCommand
if anything were to break i’d figured it would have been the path starting with a variable.
submitted by /u/jhulbe
[link] [comments]
The post illegal character in copy-item source appeared first on How to Code .NET.