[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 633
  • 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
 
meirionwylltAuthor 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

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

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