摘要:如上 将指定目录下的所有的文件名从 old 改成 new.. adding -WhatIf at the end of the command we are saying to PowerShell: 'Just test, don't actually make any permanent cha
阅读全文
随笔分类 - Scripts
PowerShell
摘要:http://powershell.com/cs/blogs/ebookv2/archive/2012/03/23/chapter-16-managing-windows-registry.aspx
阅读全文
摘要:@echo offfor /l %%i in (1,1,5) do ( tasklist /fi "imagename eq sysprep.exe" | find /i "sysprep.exe" if not errorlevel 1 ( taskkill /F /IM "sysprep.exe" if errorlevel 0 goto :NEXT ) echo Retry to terminate sysprep process... %%i if %%i EQU 5 goto :SHUTDOWN ping 1...
阅读全文
摘要:(PowerShell) 文件操作Get current ps1 file's parent path$x = Split-Path -Parent $MyInvocation.MyCommand.DefinitionCreate a folder if it does not exist.$myNewFolder = $x +"myTestFolder\"if(!(Test-Path $myNewFolder)){new-item -path $x -name myTestFolder -type directory}Open a XML file , and g
阅读全文
摘要:1.FW要升级,需要修改相关XAML中的所有旧版本到新版本。通过PowerShell 可以非常方便的找到所有的相关文件。#查找本目录中下所有的xaml文件中的 ”1.0.101“ 字符串 select-string 1.0.101 *.xaml 2. 查找指定目录下所有CS文件中的特定的字符串# D:\MyProject\ 指定要递归遍历查找的目录# *.cs 要查找的文件# myString 要查找的字符串$fileList = Get-ChildItem “D:\MyProject\" -recurse *.cs | %{$_.FullName}Foreach($file in
阅读全文