Reputation: 23
I have a static path: C:\Program Files\N-able Technologies\EndpointSetupInformation\
And then a GUID folder, which is different per machine: {10ba9c5f-8bc1-4094-c245-1e6a38d90090}
for instance, and the GUID folder is the only folder in the directory.
And then the exe file: installer.exe
I need to run that installer.exe with powershell. How can I do this simply? Basically something like: C:\Program Files\N-able Technologies\EndpointSetupInformation\{*}\installer.exe
Upvotes: 0
Views: 257
Reputation: 4020
You can have the following which will allow you to assign the full path to a variable for use later.
$installer = (Get-ChildItem 'C:\Program Files\N-able Technologies\EndpointSetupInformation\*\installer.exe').FullName
This assumes that there is only one installer.exe
file one folder deep.
You could drop the .FullName
at the end and then use $installer.FullName
instead, giving you access to all the other properties that the Get-ChildItem
has, such as .BaseName
or .DirectoryName
Upvotes: 3