• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

Using powershell for the first time - REALLY simple question.

I'm trying to run a .ps1 file located at...

C:\Program Files (x86)\Puma\Puma.ps1

...inside a batch file.  Can you tell me the batch command I need?  I have tried encasing the patch in quotation marks, i.e.

powershel.exe "C:\Program Files (x86)\Puma\Puma.ps1" -nologo

but it says 'C:\Program' is not a script, cmdlet, etc.

Does powershell have a different way of doing the same job as quotation marks in batch?

I really can't find anything about this on the web, surprisingly.

Thanks.
0
meirionwyllt
Asked:
meirionwyllt
  • 2
1 Solution
 
netballiCommented:
Just change your command as

Powershell.exe `"C:\Program Files (x86)\Puma\Puma.ps1"
0
 
XaelianCommented:
Here is a great tutorial for what you're looking to do:

http://thescriptlad.com/2011/08/16/run_ps_from_a_batchfile/
0
 
meirionwylltSenior Desktop EngineerAuthor Commented:
Really?  Is there no one-line approach??

Not that it really matters, but I didn't expect that powershell would be this restrictive seeing as its such a new language.

In your second line, in front of the $dollar sign, is that an inverted comma (on the @ key) or a ` (the button left of the number 1 key).
0
 
XaelianCommented:
You could use

powershell.exe  -File "C:\Program Files (x86)\Puma\Puma.ps1"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now