Powershell-常用脚本
Posted jinweichang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Powershell-常用脚本相关的知识,希望对你有一定的参考价值。
function Test-Port { Param([string]$ComputerName,$port = 5985,$timeout = 1000) try { $tcpclient = New-Object -TypeName system.Net.Sockets.TcpClient $iar = $tcpclient.BeginConnect($ComputerName,$port,$null,$null) $wait = $iar.AsyncWaitHandle.WaitOne($timeout,$false) if(!$wait) { $tcpclient.Close() return $false } else { # Close the connection and report the error if there is one $null = $tcpclient.EndConnect($iar) $tcpclient.Close() return $true } } catch { $false } } function copy-dir([string]$src, [string]$des) { get-childitem $src -recurse -directory | foreach-object { $tmp = $_.fullname;$tmp = $tmp.substring( $src.length, $tmp.length - $src.length ); if( -not (test-path $des$tmp) ) { new-item -path $des$tmp -type Directory -force } } }
以上是关于Powershell-常用脚本的主要内容,如果未能解决你的问题,请参考以下文章
关于js----------------分享前端开发常用代码片段