保存为.ps1文件
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy Restricted
1. 批量修改文件后缀
$CodeFileDir="." write-host $CodeFileDir $files = [System.IO.Directory]::GetFiles($CodeFileDir,"*.cs", [System.IO.SearchOption]::AllDirectories) foreach($f in $files) { $fi = New-Object System.IO.FileInfo($f) #var t = fi.FullName.Replace(fi.Extension, "_gen" + fi.Extension); $target = $fi.FullName.Replace($fi.Extension, "_gen" + $fi.Extension) write-host $target $fi.MoveTo($target); }
2. --