powershell seach const variable
来源:互联网 发布:q房网经纪人端口下载 编辑:程序博客网 时间:2024/06/11 15:40
##search const
1>.declare some const , save to E:\1.txt
2>.save codes into 1.ps1
#########################################
#Summary:Seach const varible by file name
#########################################
############################################
#Summary : Search Const Varible by Directory
############################################
3>.
a>.import module
import-module D:\1.ps1
1>.declare some const , save to E:\1.txt
public const string a = "1";public const string b = "2";public const string c = "3";public const string d = "4";
2>.save codes into 1.ps1
#########################################
#Summary:Seach const varible by file name
#########################################
function SCByFile($fn){#define regex$regex = "\s+const\s+(?<type>.*)\w?\s+(?<name>.*)\s+=\s+(?<value>.*);"#define object$obj = new-object psobject #this part may be only work in 3.0#New-Object PSObject - Property @{#FileName = ""#DataType = ""#Name = ""#Value = ""#}$obj | add-member -membertype noteproperty -value "" -name FileName$obj | add-member -membertype noteproperty -value "" -name DataType$obj | add-member -membertype noteproperty -value "" -name Name$obj | add-member -membertype noteproperty -value "" -name Value#search by regular expression patternselect-string $regex $fn |ForEach {ForEach ($match in $_.Matches){$obj.Value = $match.Groups["value"].Value$obj.Name = $match.Groups["name"].Value$obj.DataType = $match.Groups["type"].Value$obj.FileName = $fn#populate obj $obj}}}
############################################
#Summary : Search Const Varible by Directory
############################################
function SCByDir($d){$files = dir $dForEach($file in $files){SCByFile($file)}}
3>.
a>.import module
import-module D:\1.ps1
b>.run
SCByFile("E:\1.txt");
SCByDir("E:\");
- powershell seach const variable
- PowerShell 变量(Variable)
- AOL Seach query database
- eclipse的seach功能介绍
- 正则表达式一 :re.seach()
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- powershell
- Powershell
- PowerShell
- Powershell
- powershell
- PowerShell
- 高速发展的中国的社会问题,潜在超级大国和未来经济大势
- USACO报告:chapter1.1:Your Ride Is Here
- C++ 学习使用 MFC CFileDialog
- powershell basic
- powershell connect sql server
- powershell seach const variable
- 通过反射获得类的实例对象
- EditView 输入问题
- Android APK反编译
- iOS 通过URL网络获取XML数据的两种方式
- 【婷】3月29日 小记
- 完成端口(CompletionPort)详解
- 观察者模式——Head First Design Patterns
- Harry Potter’s Exam (an application of Dijkstra algorithm)