powershell-重命名文件并移动

重命名文件并移动

例如文件jinwei.txt先修改为jinwei+随机码.txt(例如:jinwei23.txt)

然后Move到to路径

$from="\10.XX.XXfrom*.*"
$to="C:	o"

$a =get-random -maximum 100
$a =[string]$a+".TXT"

Get-ChildItem -Path $from  |
    Rename-Item -NewName {$_.Name -replace ".txt",$a} -PassThru |
        Move-Item -Destination $to -Force
原文地址:https://www.cnblogs.com/JinweiChang/p/15098373.html