?
Solved

find an exe in a folder

Posted on 2012-09-13
2
Medium Priority
?
699 Views
Last Modified: 2012-09-13
Hello,

How find an exe file into a directory to run in order not to have his name in a script :
Exmaple: I want to detect SQLServer2008R2SP2-KB2630458-x64-ENU.exe
$command = "$patchdir\SQLServer2008R2SP2-KB2630458-x64-ENU.exe /q /Action=Patch /InstanceName=`"$I`" /IAcceptSQLServerLicenseTerms"

Thanks

bibi
0
Comment
Question by:bibi92
2 Comments
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 38394355
If you are certain there is only a single EXE file in the location of the $pathdir:
$exe = (gci $patchDir\SQLServer*.exe).FullName
$command = "$exe /q /Action=Patch /InstanceName=`"$I`" /IAcceptSQLServerLicenseTerms"

Open in new window

0
 

Author Closing Comment

by:bibi92
ID: 38394393
Thanks bibi
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question