1
votes

I have downloaded CPDF because I have to batch work on a large number on PDFs.

The executable is on my Desktop: C:\Users\admin\Desktop\cpdf.exe

I am running PowerShell ISE on Windows 7 as Administrator. I have set Set-ExecutionPolicy Unrestricted.

My prompt is at the desktop location: PS C:\Users\ftsadmin\Desktop> but if I try to run cpdf: PS C:\Users\ftsadmin\Desktop> cpdf or as PS C:\Users\ftsadmin\Desktop> cpdf.exe, I get the following error:

The term 'cpdf.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:9
+ cpdf.exe <<<< 
    + CategoryInfo          : ObjectNotFound: (cpdf.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I don't understand. When I am doing exactly the same in my Windows XP VM, it works (but I prefer Windows 7+ because of the PowerShell ISE).

Any ideas what I'm missing?

1

1 Answers

4
votes

Unlike CMD PowerShell does not automatically include the current directory in the search path (it behaves like Unix shells in this respect). To run a program or script from the current directory you need to use the relative or absolute path:

.\cpdf.exe
C:\Users\ftsadmin\Desktop\cpdf.exe

The execution policy has nothing to do with this, as it governs only the execution of PowerShell scripts, not of external commands.