Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Newbie: running external script

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 12-22-2006   #1 (permalink)
bill
Guest


 

Newbie: running external script

I want to create a simple (.ps1) script and run it outside of Powershell
(double-click the script from Windows and have it start automatically).

Any ideas how to do this, much appreciated.

Bill



My System SpecsSystem Spec
Old 12-22-2006   #2 (permalink)
John Smith
Guest


 

RE: Newbie: running external script

I find that it's no different from a .bat file. The shell opens up,
executes, and then disappears unless you have something that pauses it.

On my system, .PS1 files are by default associated to notepad.exe. Do a
right-click Open With and then Choose Program... The path to PowerShell is in
the variable $PSHOME.

My System SpecsSystem Spec
Old 12-22-2006   #3 (permalink)
IT Staff
Guest


 

Re: Newbie: running external script

usually i create the .ps1 with arguments built in.

Then at cmd prmopt, i type "powershell d:\<filename>.ps1 arguments"

It is similar to "cscript d:\<filename>.vbs arguments"

double click and it will disappear fast and u can't see results.



"bill" <bill@discussions.microsoft.com> wrote in message
news:A67B6FF7-5EAB-4633-B8B5-02D2F14EA719@microsoft.com...
>I want to create a simple (.ps1) script and run it outside of Powershell
> (double-click the script from Windows and have it start automatically).
>
> Any ideas how to do this, much appreciated.
>
> Bill
>
>



My System SpecsSystem Spec
Old 12-22-2006   #4 (permalink)
RichS
Guest


 

Re: Newbie: running external script

Default behaviour is for a PowerShell script not to be runnable by double
clicking - security feature.

If need to run script outside shell best way is either as previous post
states or create shortcut to powershell and add a command eg.

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -Command
C:\Scripts\Monad\Services-Processes\stop-sqlservice.ps1

--
Richard Siddaway

Please note that all scripts are supplied "as is" and with no warranty


"IT Staff" wrote:

> usually i create the .ps1 with arguments built in.
>
> Then at cmd prmopt, i type "powershell d:\<filename>.ps1 arguments"
>
> It is similar to "cscript d:\<filename>.vbs arguments"
>
> double click and it will disappear fast and u can't see results.
>
>
>
> "bill" <bill@discussions.microsoft.com> wrote in message
> news:A67B6FF7-5EAB-4633-B8B5-02D2F14EA719@microsoft.com...
> >I want to create a simple (.ps1) script and run it outside of Powershell
> > (double-click the script from Windows and have it start automatically).
> >
> > Any ideas how to do this, much appreciated.
> >
> > Bill
> >
> >

>
>
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an external script. rush PowerShell 12 01-26-2008 12:21 PM
Newbie question - Is there a script/command to do a backup of a di dob PowerShell 4 01-03-2008 09:45 AM
Newbie Question: Here-Script with PowerShell Raymund Hemmerling PowerShell 6 09-28-2007 03:34 AM
Newbie Needs Help With Folder script! Mícheál PowerShell 4 04-16-2007 05:05 AM
Help on running a a script Toxic PowerShell 3 12-05-2006 11:35 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51