7

I got a problem when try to run powershell from command line. I typed powershell.exe when pop up window shows up in blue background saying: "This app cant run on your PC, to find version for your PC check publisher". Then command prompt gives message: "Access is denied."

Any suggestions would be highly appreciated.

5
  • Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User. Commented Aug 20, 2015 at 13:35
  • @Luke " unless they directly involve tools used primarily for programming". Yes, thats the case I am having. Commented Aug 21, 2015 at 12:06
  • What is the code you are having issues with? Commented Aug 21, 2015 at 15:05
  • Anything, say echo "hello" will not work because of power shell issue. BUT it runs on WINDOWS PowerShell ISE. Commented Aug 24, 2015 at 8:13
  • Try to re-install .net framework Commented Aug 24, 2015 at 13:08

1 Answer 1

4

My problem was that C:/windows/system32/powershell.exe was invalid as you can see on the image below:

enter image description here

I could found the right executable in C:\Windows\System32\WindowsPowerShell\v1.0\.

So if this is your problem, try the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe .\my-script.ps1

Instead of this:

powershell.exe .\my-script.ps1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.