2017年1月12日星期四

Windows PowerShell

简单入门

powershell-notes.pdf

提示无法执行 ps1

set-executionpolicy remotesigned

批量 move 文件到指定的子目录

Get-ChildItem -Filter "*.*" |ForEach-Object {     $f = $_.name;       $d=$f -replace "-.*","";     mkdir $d;    Move-Item $f $d$f;  }

命令行参数

$args

下载文件

Invoke-WebRequest  "http://xxx.xxx.xxx/yyy.mp3" -Method GET -OutFile "yyy.mp3";

转换utf8编码的文件为本地编码(一般是gbk)

cat utf8_some.txt -Encoding utf8 > gbk_some.txt

没有评论:

发表评论