标签:err path ror rect sockets soc director string dir
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 } } }
标签:err path ror rect sockets soc director string dir
原文地址:https://www.cnblogs.com/JinweiChang/p/10819154.html