Powershell executing .exe file without the folder path

powershell

Solution

# 1. Get the location of RunMe.exe
$RunMe = Get-ChildItem -Path d:\* -Include RunMe.exe -Recurse;
# 2. Invoke RunMe.exe
Start-Process -FilePath $RunMe[0].FullName -Wait -NoNewWindow;

Problem

I am fairly new to powershell and I am trying to create a script that executes a .exe file. I can execute them on my machine no problem because the folder path is hard coded. The problem is that if I shift this script to another computer, the .exe it calls might be located in a different folder structure. Example My computer: D:\Folder1\subfolder\RunMe.exe Client computer might be D:\RunMe\subfolder\RunMe.exe I just need it to execute the RunMe.exe no matter where it is. Is there a way to do this in powershell?

Original source