- #&cls&@cd /d "%~dp0" & powershell -c "Get-Content '%~0' | Out-String | Invoke-Expression " & pause&exit
- cls
- #变量设置
- $txt_file = 'b.txt'
- $src_dir = 'D:\A\rar'
- $dest_dir = 'D:\123'
- New-Item -ItemType Directory -Path @($src_dir,$dest_dir) -ErrorAction SilentlyContinue
- #读取列表
- $tag_arr = Get-Content -Path $txt_file -Encoding UTF8
- #移动
- Get-ChildItem -Path $src_dir | Where-Object { !$_.PsIsContainer -and $tag_arr -contains $_.Name } | foreach {
- Move-Item -LiteralPath $_.FullName -Destination $dest_dir
- }
复制代码
|