Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Write-Host "TAG NAME SEARCHING TOOL"

Write-Host "Authors: Le Minh Duc - 1024230 - NSRP/PC&A"


Write-Host "Version: 1.0 - 05 January 2023"
Write-Host "Description: Tool to search any Tag Name in any files in any
Directories (and its sub-directories)`n"
while($true)
{
$Option = Read-Host -Prompt "Enter option:`n`t1-Default:`n`t`tFile name:
*.html`n`t`tDirectory: C:\ProgramData\Honeywell\Experion PKS\Client\Abstract`n`t2-
Advanced: use Wildcard and options for File name and Directory name`n`t"
Write-Output "`t==> Option is: $Option"
$TagName = Read-Host -Prompt "1. Enter Tag Name to search (for example: 014*7101,
*7101, 014UZU*)"
Write-Output "`t==> TagName is: $TagName"
if ($Option -like '1')
{

Get-ChildItem -Path C:\ProgramData\Honeywell\"Experion PKS"\Client\Abstract\


*.html -Recurse -Force | Select-String -pattern $TagName -List | Select Path
}
else
{
$Dir = Read-Host -Prompt "2. Enter Directory to search (no \ at last). "
Write-Output "`t==> Directory is: $Dir"
$option2 = Read-Host -Prompt "3. Enter Option for File name:`n`t1 - All files
`n`t2 - Specific File Name`n`t"
if ($Option2 -like '2')
{
$FileName = Read-Host -Prompt "4. Enter File Name to search (full name
or use asterisk * if not full) "
Write-Output "`t==> File Name is: $FileName"
$fullpath = join-path -path $Dir -childpath $FileName
Get-ChildItem -Path $fullpath -Recurse -Force | Select-String -pattern
$TagName -List | Select Path
}
else
{
Get-ChildItem -Path $Dir -Recurse -Force | Select-String -pattern
$TagName -List | Select Path

}
}
Write-Host "Tesst"
Start-Sleep -Second 1
}

You might also like