Share via


Powershell cannot find executable in search path

Question

Saturday, June 4, 2016 7:24 AM

I have an executable file fciv located in "E:\My Software\FCIV".

I have added the "E:\My Software\FCIV" directory to PATH from edit environment variables.

So now when i type fciv and hit enter, PowerShell throws command not found exception.

I went through the command trace and found that it is looking for fciv in the right folder.

Here are the relevant lines from the trace:

DEBUG: CommandDiscovery Information: 0 : Looking for fciv.ps1 in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.psm1 in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.psd1 in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.COM in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.EXE in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.BAT in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.CMD in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.VBS in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.VBE in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.JS in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.JSE in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.WSF in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.WSH in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.MSC in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.CPL in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandDiscovery Information: 0 : Looking for fciv in "E:\My Software\FCIV"
DEBUG: CommandSearch Information: 0 :  WriteLine   Current directory results are invalid
DEBUG: CommandSearch Information: 0 :  WriteLine   Current patterns exhausted in current directory: "E:\My Software\FCIV"

I wonder what else i am supposed to do.

Note that i have set the Execution Policy to unrestricted.

Any Help would be appreciated.

All replies (5)

Saturday, June 4, 2016 6:56 PM âś…Answered

I removed the double quotes in my path variable and it works now, in both admin and standard.

I don't understand why your test must have failed in the admin though.


Saturday, June 4, 2016 6:07 PM

Are you running this in an Admin PowerShell prompt? A test for me worked in a standard PowerShell prompt, but failed to find in an Admin one.


Saturday, June 4, 2016 6:54 PM

I have found out what the problem is.

    "E:My Software\FCIV"

was within double quotes in my path variable, while no other folder was.

The command prompt cmd was able to work despite this, but it seems powershell cannot, don't see why though.


Saturday, June 4, 2016 9:14 PM

Ah my test had a fciv test file on a network drive, so that is not accessible via admin prompt. Also my path did not have a space in it, so that explains the difference to me.


Tuesday, June 7, 2016 7:00 AM

Hi Vikash,

Glad to hear that you have found out the cause of problem, thanks for sharing.

We really appreciate your time and efforts. Hope your experience will help other community members facing similar problems.

Kindly mark your reply to close this case.

Please mark the reply as an answer if you find it is helpful.

If you have feedback for TechNet Support, contact [email protected]