Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Appending text to the beginning of a variable file name

$
0
0

$files will contain whatever Get-ChildItem returns – so you can use any switch of Get-ChildItem, and that includes -Include.

You need to consider how you’re running Get-ChildItem. The error tells me that it returned the file c:\scripts\PowerShell\test.jpg. I can’t tell you how that path got into $files. I’m assuming you modified Get-ChildItem somehow, or did something. Try adding a line to your script like Write-Output $files. That would come after the Get-ChildItem and before the ForEach. That’ll let you see that the variable contains. If you’re not happy with what it contains, then modify your Get-ChildItem appropriately.


Viewing all articles
Browse latest Browse all 13067

Trending Articles