by dwwilson66 at 2013-01-24 05:35:52
This morning, I copied a directory from my local, networked drive to temp folder for testing. When I ran the script, this error appeared.by nohandle at 2013-01-24 06:39:15
Get-Content : Cannot find path 'C:\users\xxxxx\desktop\cgc\Automatic_Post-Call_Survey_-_BC,CC.txt’ because it does no
At C:\users\xxxxx\desktop\cgc\testcountexcl1.ps1:55 char:12
+ Get-Content <<<< $txtfile | Get-WordCount -Exclude (Get-Content c:\temp\exclude.txt) | select -First 15
+ CategoryInfo : ObjectNotFound: (C:\users\xxxxx…ey-_BC,_CC.txt:String) [Get-Content], ItemNotFoundEx
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
This would be expected with the move…PS can’t find the path referenced…but I made the following change prior to running the script (old commented out above the new):
$input = Get-Content c:\temp\wordCount.txt
<# $inpath = “C:\users\xxxxx\desktop\cgc\tx” #>
$inpath = “C:\temp\tx”
$srcfiles = Get-ChildItem $inpath -filter “*.txt”
$notPermittedWords = Get-Content c:\temp\exclude.txt
My first inkling is that there’s some kind of cache holding my
$inpathvariable from my last run…but have not been able to find out if that’s expected PowerShell behavior. Am I misinterpreting the error or the solution? How do I flush the cache or whatever varables may be stored in memory?
How exactly did you run the script?