2016-08-17 76 views

回答

0

你在這裏有點深奧......編寫腳本會更容易。

這裏是一個基本的腳本,你可以從這裏展開:

#Get the path 
$path = "$env:USERPROFILE\Desktop" 

#Get the files in the path 
$Files = Get-ChildItem $path 

#Loop through each file 
foreach($file in $files) 
{ 
    #Check to see if it's a text file 
    if($file -like "*.txt") 
    { 
     #Delete the file and do not confirm 
     Remove-Item $file -Confirm:$false -ErrorAction SilentlyContinue 
    } 
} 
相關問題