檢視 PowerShell 的原始碼
←
PowerShell
跳至導覽
跳至搜尋
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
'''PowerShell''' *{{wikipedia|PowerShell|lang=en}} *{{wikiversity|PowerShell|lang=en}} *[https://docs.microsoft.com/zh-tw/powershell/scripting/install/windows-powershell-system-requirements Windows PowerShell 系統需求] *參照: **[http://social.technet.microsoft.com/Forums/zh-TW/powershellzhcht/threads Windows PowerShell 論壇] **[http://technet.microsoft.com/zh-tw/scriptcenter/default.aspx 指令碼中心] ;安裝 *[http://support.microsoft.com/kb/968930/zh-tw KB968930 - Windows Management Framework Core package (Windows PowerShell 2.0 and WinRM 2.0)] *[http://support.microsoft.com/kb/968929/zh-tw KB968929 - Windows Management Framework (Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0)] ;啟動方法 *【開始】→【執行】→【powershell】 ==技術文件== <!-- *[http://www.microsoft.com/downloads/details.aspx?FamilyId=DF8ED469-9007-401C-85E7-46649A32D0E0&displaylang=en Windows PowerShell Quick Reference] //--> *[http://www.microsoft.com/taiwan/technet/columns/profwin/28-monad.mspx 易學易用的 Windows PowerShell] *[http://search.microsoft.com/results.aspx?mkt=zh-TW&setlang=zh-TW&q=Windows+PowerShell 搜尋微軟網站上的『Windows PowerShell』] *[https://ithelp.ithome.com.tw/users/20005121/ironman/54 強而有力的 Windows PowerShell :: 2009 iT 邦幫忙鐵人賽] <!-- ;Technet 專欄 #[http://www.microsoft.com/taiwan/technet/columns/profwin/56-Winpowerwshell.mspx Windows PowerShell 講座 (1)—指令、重導、別名] #[http://www.microsoft.com/taiwan/technet/columns/profwin/64-Winpowerwshell2.mspx Windows PowerShell 講座 (2)—自訂工作環境] #[http://www.microsoft.com/taiwan/technet/columns/profwin/65-Winpowerwshell3.mspx Windows PowerShell 講座 (3)— PS 磁碟機] #[http://www.microsoft.com/taiwan/technet/columns/profwin/66-Winpowerwshell4.mspx Windows PowerShell 講座(4)—變數] #[http://www.microsoft.com/taiwan/technet/columns/profwin/67-Winpowerwshell5.mspx Windows PowerShell 講座 (5)—存資料的其他方式及編寫指令碼的前置準備] //--> ==常用指令== *Get-Help :取得指令的使用說明 *exit :離開PowerShell *HELP :線上說明 *kill :停止執行中的程序 *ps :顯示執行中的程序狀態 ==相關套件== *[http://www.microsoft.com/downloads/details.aspx?FamilyID=50633A1F-A665-425D-923C-1A269F8AC084&displayLang=en Windows PowerShell 2.0 Software Development Kit (SDK)] *[http://www.codeplex.com/powershellremoting/ PowerShell Remoting](遠端操作相關) :*[http://forums.microsoft.com/Technet-CHT/ShowPost.aspx?PostID=3272993&SiteID=23 Technet討論區 - 請問 PowerShell 可否遠端登入] ==應用== *[http://www.microsoft.com/taiwan/technet/scriptcenter/resources/qanda/mar07/hey0326.mspx 如何使用 Windows PowerShell 以便在應用程式終止時收到通知?] *[http://www.microsoft.com/technet/scriptcenter/resources/qanda/oct07/hey1031.mspx How Can I Use Windows PowerShell to Delete All the Files in a Folder Older Than 90 Days?] *[http://blog.darkthread.net/blogs/darkthreadtw/archive/2007/11/23/my-first-powershell-script.aspx#3432 檢查檔案是否存在?如不存在則發email通知] *[http://gallery.technet.microsoft.com/scriptcenter/files-from-websites-4a181ff3 Download files from websites programatically via powershell] ===C#=== *[http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C How to run PowerShell scripts from C#] ==FAQ== ===改善PowerShell的效能=== *[https://blog.miniasp.com/post/2019/01/11/ProgressPreference-slow-down-powershell-execution 如何修正 PowerShell 執行龜速的元兇 (關閉進度列提示) ] ===取得網路卡資訊=== Get-WmiObject win32_NetworkAdapter | %{ if ($_.PhysicalAdapter -and $_.Name -notmatch "Virtual") {$_ } } ===使用7z=== *[https://ithelp.ithome.com.tw/questions/10194801 Windows 腳本語言選擇] **Windows powershell還是可以使用7Z **重新命名資料夾名稱 **使用xml檔 ===使用git=== *[https://ithelp.ithome.com.tw/questions/10194817 使用 git 一次性的針對所有主機做更新(git pull)?] ===使用xml=== *[https://ithelp.ithome.com.tw/questions/10194816 powershell操作xml更改檔案內特定位置內容] ===取得資料夾內附檔名為zip的檔名=== <source lang="powershell"> $Dir="D:/Folder" foreach($item in (dir $Dir "*.zip")){ Echo $item.Name } </source> ===關閉程式與執行程式=== *出處: [https://ithelp.ithome.com.tw/questions/10190951 PowerShell 偵測執行程式,並重啟 - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天] ;關閉程式 <source lang="powershell"> #取得授權 Set-ExecutionPolicy RemoteSigned #判斷與停止Client if(Get-Process client -ErrorAction SilentlyContinue) { Stop-Process -Name client } #等待1s Start-Sleep -s 1 </source> ;執行程式 <source lang="powershell"> #取得授權 Set-ExecutionPolicy RemoteSigned #執行項目 [System.Diagnostics.Process]::Start("C:\Client\client.exe", "") </source> ===除超過30天的資料庫備份檔=== *參考: [https://medium.com/@jamieleetw95/powershell-%E8%87%AA%E5%8B%95%E5%88%AA%E9%99%A4%E6%AA%94%E6%A1%88-%E6%8C%89%E7%85%A7%E6%AA%94%E6%A1%88%E4%BF%AE%E6%94%B9%E6%97%A5-%E4%BF%9D%E7%95%99%E8%BF%91n%E5%A4%A9%E5%85%A7%E7%9A%84%E6%AA%94%E6%A1%88-46eabad9f465 用PowerShell刪除N天前或指定日期(前後)建立(或修改)的檔案 | 程式前沿] <source lang="powershell"> #取今日時間 $Currentlytime = (Get-Date).AddDays(-$Days) $Dirs = Get-Childitem -Path $TargetFolder -Recurse -Include *.bak foreach ($item in $Dirs) { #判斷檔案最後修改時間 #由LastWriteTime抓取檔案最後修改時間 #利用AddDays對$Currentlytime做時間的運算 if($item.LastWriteTime -le $Currentlytime) #-le 小於或等於 { Remove-Item $item.FullName | out-null write-host "Finish Deleting Dir $item" -ForegroundColor "DarkRed" } } </source> ==相關== *[http://www.pstips.net/ PowerShell 中文博客] - ''收集和分享PowerShell相关教程,技术和最新动态'' [[Category:軟體]] [[Category:Microsoft]] [[Category:.NetFramework]]
此頁面使用了以下模板:
模板:Wikipedia
(
檢視原始碼
)
模板:Wikiversity
(
檢視原始碼
)
返回「
PowerShell
」頁面
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
視圖
閱讀
檢視原始碼
檢視歷史
更多
搜尋
導覽
首頁
社群入口
新聞動態
新聞直播
近期變更
Online IDE
分類
程式語言
資料結構
演算法
技術
軟體
SQL資料庫
網站套件
免費資源
副檔名
檔案格式
分類
其他
動畫
漫畫
小說
小說導讀
驅動程式
購物用
求職網站
推薦書單
線上學習
技術類News或部落格
Microsoft devblogs
網頁技術News
資料技術News
安全性相關News
MS-MVP
藍色小舖認證專家
經營行銷類部落格
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊