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

writing ps script

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-15-2006   #1 (permalink)
IT Staff
Guest


 

writing ps script

Say i've got all the coding done and it works with in the interactive mode.

i thot i can save the file into *.ps extension and from cmd prompt call
powershell.exe filename.ps ...does this work ?




My System SpecsSystem Spec
Old 10-16-2006   #2 (permalink)
dreeschkind
Guest


 

RE: writing ps script

The correct extension for PowerShell script files is ".ps1" (note the version
number).
Invoking the script file from cmd.exe should work like this:

powershell.exe -command C:\do-foo.ps1

--
greetings
dreeschkind

"IT Staff" wrote:

> Say i've got all the coding done and it works with in the interactive mode.
>
> i thot i can save the file into *.ps extension and from cmd prompt call
> powershell.exe filename.ps ...does this work ?
>
>
>
>

My System SpecsSystem Spec
Old 10-19-2006   #3 (permalink)
IT Staff
Guest


 

Re: writing ps script

At first, i tried to run your command below and got this error :

H:\>powershell -command d:\test.ps1
File D:\test.ps1 cannot be loaded. The file D:\test.ps1 is not digitally
signed
.. The script will not execute on the system. Please see "get-help
about_signing
" for more details..
At line:1 char:11
+ d:\test.ps1 <<<<

Then i realised it is about signing problems so i changed to REmotesigned.
The script runs fine after that.








"dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
news:5F0190F8-4FB6-45BB-B321-9FB97D874E6B@microsoft.com...
> The correct extension for PowerShell script files is ".ps1" (note the
> version
> number).
> Invoking the script file from cmd.exe should work like this:
>
> powershell.exe -command C:\do-foo.ps1
>
> --
> greetings
> dreeschkind
>
> "IT Staff" wrote:
>
>> Say i've got all the coding done and it works with in the interactive
>> mode.
>>
>> i thot i can save the file into *.ps extension and from cmd prompt call
>> powershell.exe filename.ps ...does this work ?
>>
>>
>>
>>



My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Include another script, keep variables in included script? pschmidt PowerShell 32 08-18-2008 01:48 PM
Script file has 'OS Handle' error when run from script Jay PowerShell 1 09-18-2007 07:06 PM
Can you drag-n-drop a file on top of a PS script to run the script? Jen Taylor PowerShell 6 04-06-2007 09:02 AM
Demo: Writing a PS script app wrapper for Halo Alex K. Angelopoulos [MVP] PowerShell 0 08-09-2006 04:22 PM
What are best prictices when writing a script? =?Utf-8?B?QW5kcmV3IFNhdmlueWto?= PowerShell 0 08-05-2006 01:15 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