dir "*.exe" | % {."$_"}
- 11月 24 週三 201021:44
[powershell]依續執行目錄下的所有exe
- 11月 02 週二 201021:27
用powershell寫一個把目前目錄下的程式碼都轉換成utf8的程式(日文也ok)
# 只能轉與系統同編碼的ansi
function tounicode($orginFile = $(throw "input file required"))
{
$data = get-content $orginFile
set-content -value $data $orginFile -encoding utf8
}
function tounicode($orginFile = $(throw "input file required"))
{
$data = get-content $orginFile
set-content -value $data $orginFile -encoding utf8
}
- 10月 19 週二 201019:25
power shell 幫我清除obj
dir -r | % {if ($_ -like "*.obj") {del $_.FullName} }
解釋:
dir 列出目錄
-r 遞迴進入子目錄
| 把資料傳給...
% 就是foreach
{ 要做的事 }
if 判斷
$_ 傳來的參數簡寫
-like 字串比較
del 刪除
$_.FullName 檔案全名
解釋:
dir 列出目錄
-r 遞迴進入子目錄
| 把資料傳給...
% 就是foreach
{ 要做的事 }
if 判斷
$_ 傳來的參數簡寫
-like 字串比較
del 刪除
$_.FullName 檔案全名
1
