Set-Location C:\Users\shichng\Desktop\test
$a=Get-ChildItem -Force -Recurse C:\Users\shichng\Desktop\test
foreach($b in $a)
{ $c=$b.name+".txt"
Rename-Item $b -NewName $c -Force
}
$a=Get-ChildItem -Force -Recurse C:\Users\shichng\Desktop\test -Include *.txt
foreach($b in $a)
{
$C=$b.name
$d=$c.TrimStart("")
rename-item $b -newname $d -force
}
$a=Get-ChildItem -Force -Recurse C:\Users\shichng\Desktop\test -Include *.txt
foreach($b in $a)
{
$c=get-content $b -totalcount 1
$d=$c+”.txt”
rename-item $b -newname $d -force
}