• 周六. 7 月 27th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

powershell-重命名文件并移动

admin

11 月 28, 2021

重命名文件并移动

例如文件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

发表回复