文章分类 - power shell
power than shell...
powershell监控file create
摘要:使用powershell监控某个路径下是否有新的文件生成,如果有新的文件生成则拷贝:代码如下:#script for monitor and copy file$global:folder = '\\Share\lbx' # upload path $filter = '*.*' #copy file type$global:pathFunction MonitorAndCopyFile{$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Prop...
阅读全文
power shell 对域控进行操作
摘要:$name= read-host -Prompt "please Enter the ComputerName you want to use"$domain=read-host -Prompt "please Enter the domain you want to add (enter test1 or test2)"#host file path$HostsLocation = "$env:windir\System32\drivers\etc\hosts"if($domain.Equals("test1")
阅读全文
power shell function
摘要: 函数是具有指定名称的语句列表。在运行函数时,需键入函数名称。列表中语句的运行效果 与在命令提示符下键入它们时的运行效果相同。 与 cmdlet 类似,函数也可带有参数。参数可以是位置参数、命名参数、开关参数或动态参数。 函数参数可从命令行或通过管道读取。#位置参数function toUpper { foreach ($a in $args) { $a.toUpper() } } toupper hello james fancy #在这里使用了一个未命名参数的数组$args#命名参数function hello($name, $isMale) { if ([bool]::parse(..
阅读全文
浙公网安备 33010602011771号