本帖最后由 yhcfsr 于 2020-11-7 08:31 编辑
- #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause&exit
-
- $Script:移动后的目录='存档'
- $Script:文件所在目录='./'
- $Script:天数设置 =(Get-Date).AddDays(-2);
-
- $suffix = "{0:yyyy.MM.d}.txt" -f $Script:天数设置
- if(-not (Test-Path -Path $Script:移动后的目录)){md $Script:移动后的目录}
- Get-ChildItem -File -Path $Script:文件所在目录 -Filter "*$($suffix)" -Recurse|Where-Object{Move-Item -Path $_.FullName -Destination $Script:移动后的目录}
复制代码 用法:设置好行3,4,5的变量值, 保存为BAT执行 |