Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
$EXE = "WINWORD.EXE"
#RegQuery
$EXEPATH = Get-ItemPropertyValue Registry::"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$EXE" -Name Path
IF ($EXEPATH){$EXEPATH = "$EXEPATH$EXE"}

#Where via Path
IF (!$EXEPATH) {$EXEPATH = (get-command $EXE).Path 2> $null}

#Search Dir
IF (!$EXEPATH) {$EXEPATH = (Get-ChildItem "C:\Program Files\Microsoft Office" -Recurse $EXE).FullName 2> $null}
IF (!$EXEPATH) {$EXEPATH = (Get-ChildItem "C:\Program Files\Adobe" -Recurse $EXE).FullName 2> $null}
IF (!$EXEPATH) {$EXEPATH = (Get-ChildItem "C:\Program Files (x86)\Microsoft Office" -Recurse $EXE).FullName 2> $null}
IF (!$EXEPATH) {$EXEPATH = (Get-ChildItem "C:\Program Files (x86)\Adobe" -Recurse $EXE).FullName 2> $null}
$EXEPATH
PAUSE
  • No labels