เช้านี้ ฉันคัดลอกไดเร็กทอรีจากไดรฟ์ในเครือข่ายภายในเครื่องของฉันไปยังโฟลเดอร์ชั่วคราวเพื่อทำการทดสอบ ข้อผิดพลาดนี้ปรากฏขึ้น
Get-Content : Cannot find path 'C:\users\xxxxx\desktop\cgc\Automatic_Post-Call_Survey_-_BC,_CC.txt' because it does no
t exist.
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
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
สิ่งนี้คาดว่าจะเกิดขึ้นกับการย้าย...PS ไม่พบเส้นทางที่อ้างอิง...แต่ฉันทำการเปลี่ยนแปลงต่อไปนี้ก่อนที่จะเรียกใช้สคริปต์ (ความคิดเห็นเก่าอยู่เหนือสิ่งใหม่):
$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
ความเฉลียวแรกของฉันคือมีแคชบางประเภทที่เก็บตัวแปร $inpath
ของฉันจากการรันครั้งล่าสุดของฉัน...แต่ไม่สามารถทราบได้ว่านั่นเป็นพฤติกรรมของ PowerShell ที่คาดหวังหรือไม่ ฉันตีความข้อผิดพลาดหรือวิธีแก้ปัญหาผิดไปหรือเปล่า? ฉันจะล้างแคชหรือตัวแปรใด ๆ ที่อาจเก็บไว้ในหน่วยความจำได้อย่างไร
$inpath
และ$srcfiles
ถูกดำเนินการเป็นครั้งที่สองด้วยค่าใหม่หรือไม่ - person Frode F.   schedule 24.01.2013