Process in Shell
2015-12-20 19:01
561 查看
$PID #current process Get-Process Get-Process | Select-Object Name Get-Process -processname "jm" | Select-Object * Get-Process -processname "jm" | Select-Object WorkingSet64 Stop-Process -processname baiduyunguanjia stop-Process -Id 9556 kill -Id 9556 # help get-help stop-process Get-help kill get-help Stop-Process -Examples Get-Help kill -Online Get-Process | Where-Object {$_.ProcessName.Contains("baiduyunguanjia") } Get-Process | Where-Object # special notation # http://blog.chinaunix.net/uid-9781829-id-1997782.html # kill process {$_.ProcessName.Contains("baiduyunguanjia") } | Stop-Process -CONFIRM Get-Process | Where-Object {$_.ProcessName.Contains("baiduyunguanjia") } | Stop-Process -force # date Get-Date (Get-Date).DayOfWeek # data structure Get-Member # most important Get-Help -Name # get help information Get-Command # command Get-Service | Format-table | Format-Custom | Format-Wide | Format-List Get-Service | Get-Member -MemberType Property Get-Service | format-table name, servicetype, canshutdown
# Filter 1,2,3,4 | Where-Object -FilterScript {$_ -lt 3} Get-WmiObject -Class Win32_SystemDriver | Get-Member -MemberType Property Get-WmiObject -Class Win32_SystemDriver | Where-Object -FilterScript {$_.State -eq "Running"} Get-WmiObject -Class Win32_SystemDriver | Where-Object -FilterScript {$_.State -eq "Running"} | Where-Object -FilterScript {$_.StartMode -eq "Auto"} Get-WmiObject -Class Win32_SystemDriver | Where-Object -FilterScript {$_.State -eq "Running"} | Where-Object -FilterScript {$_.StartMode -eq "Manual"} | Format-Table -Property Name,DisplayName Get-ChildItem env:
# change file constrain # http://www.cnblogs.com/binw/p/3921743.html Get-Acl -Path <File or Folder Path> | Format-List # get one file's right and give it to another Get-Acl "W:\Test\test01.txt" | Set-Acl -Path "W:\Test\test02.txt" # WinSCP does batch processing # http://www.cnblogs.com/binw/p/4065607.html
# a reference blog # http://www.cnblogs.com/dreamer-fish/archive/2013/01/26/2878144.html[/code]# some basic operations # remove all files in a folder Remove-Item C:\tobedeleted –Recurse # reborn current computer (Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(2) # get all child item recururse Get-ChildItem –Force c:\directory –Recurse Get-WmiObject -Class Win32_ComputerSystem Get-WmiObject -Class win32_BIOS -ComputerName . Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName . # get current user Get-WmiObject -Class Win32_ComputerSystem -Property UserName -ComputerName . Get-WmiObject -Class Win32_Product -ComputerName . | Format-Wide -Column 1 # current IP address Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Format-Table -Property IPAddress Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object -Property [a-z]* -ExcludeProperty IPX*,WINS* Get-WmiObject -Class win32_networkadapterconfiguration -Filter "DHCPEnabled = true" -ComputerName . Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=true -ComputerName . | ForEach-Object -Process {$_.EnableDHCP()}# software management # equip MSI packet (Get-WMIObject -ComputerName TARGETMACHINE -List | Where-Object -FilterScript {$_.Name -eq "Win32_Product"}).Install(\\MACHINEWHEREMSIRESIDES\path\package.msi) # uplevel MSI (Get-WmiObject -Class Win32_Product -ComputerName . -Filter "Name='name_of_app_to_be_upgraded'").Upgrade(\\MACHINEWHEREMSIRESIDES\path\upgrade_package.msi) # remove current packet from current computer (Get-WmiObject -Class Win32_Product -Filter "Name='product_to_remove'" -ComputerName . ).Uninstall()# machine management # shut down another computer after 60 seconds Start-Sleep 60; Restart-Computer –Force –ComputerName TARGETMACHINE # add printer (New-Object -ComObject WScript.Network).AddWindowsPrinterConnection(\\printerserver\hplaser3) # remove printer (New-Object -ComObject WScript.Network).RemovePrinterConnection("\\printerserver\hplaser3 ") EXE > http://www.tuicool.com/articles/AbmAvq >ttp://www.cnblogs.com/dudu/archive/2011/08/23/ProcessStartInfo_bat_powershell.html >http://club.topsage.com/thread-2134637-1-1.html Parameter: > http://www.pstips.net/powershell-pass-args-to-scripts.html >http://blog.vichamp.com/powershell/tip/2014/04/30/getting-arguments-from-command-line/ >http://www.pstips.net/question/4418.html >http://www.jb51.net/article/49853.htm >http://www.pstips.net/powershell-launching-applications.html >http://www.jb51.net/article/53583.htm >http://www.jb51.net/article/53065.htm IP: > http://www.pstips.net/get-current-ip.html > http://www.pstips.net/get-all-assigned-ip-addresses.html >http://www.cnblogs.com/dudu/archive/2011/08/23/ProcessStartInfo_bat_powershell.html Create New Folder: > http://blog.csdn.net/itanders/article/details/1731811 Process: > http://stackoverflow.com/questions/651223/powershell-start-process-and-cmdline-switches
相关文章推荐
- OS X 黑科技 使用bash 播放mp3
- shell split 字符串 三种方式和效率
- BASH基础特性总结
- shell脚本错误:syntax error near unexpected token '$'\r''
- awk 输出值到多个变量
- shell 命令之 find 命令四
- lshell限制用户使用命令及其访问目录
- shell 命令之 find 命令三
- Bash命令行编辑
- 《Linux命令、编辑器与Shell编程》读书笔记6-磁盘和文件系统管理
- Powershell-Lync:如何查询用户使用的语音策略
- Powershell-Exchange:获取移动设备列表
- Shell 学习
- Shell脚本
- Powershell-Exchange:服务状态监测
- Powershell-Exchange:如何确认exchange的小版本号
- 快来帮 Bash 投票新 LOGO 吧!
- Shell实现自动更新目录名称与文件中版本号信息与时间戳
- Linux shell 之 awk的用法
- Powershell-Exchange:设置分层通讯薄中通讯组的优先级