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

how to write a function

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-18-2007   #1 (permalink)
IT Staff
Guest


 

how to write a function

Think this shld be easy for the forum members, but i could not find any info
on this :

eg

Function sum(x, y)
return sum(x+y)
end function

How to translate to powershell function ?



My System SpecsSystem Spec
Old 01-18-2007   #2 (permalink)
$hay
Guest


 

Re: how to write a function

function sum{
param([int]$x,[int]$y)
$x+$y
}

invoke it by typing into the console

sum 2 2

--
$hay
http://scriptolog.blogspot.com




"IT Staff" <jkklim@hotmail.com> wrote in message
news:udffvktOHHA.3544@TK2MSFTNGP03.phx.gbl...
> Think this shld be easy for the forum members, but i could not find any
> info on this :
>
> eg
>
> Function sum(x, y)
> return sum(x+y)
> end function
>
> How to translate to powershell function ?
>



My System SpecsSystem Spec
Old 01-18-2007   #3 (permalink)
Desmond Lee
Guest


 

RE: how to write a function

Talk a look at this which may be helpful to your PowerShell (function) venture:

http://mybsinfo.blogspot.com/2007/01...rocess-to.html

HTH.
--
............... All new, all fresh ..............
http://www.leedesmond.com/weblog/



"IT Staff" wrote:

> Think this shld be easy for the forum members, but i could not find any info
> on this :
>
> eg
>
> Function sum(x, y)
> return sum(x+y)
> end function
>
> How to translate to powershell function ?
>
>
>

My System SpecsSystem Spec
Old 01-21-2007   #4 (permalink)
Andrew Watt [MVP]
Guest


 

Re: how to write a function

Hi,

Type

help about_function

to access general help on this topic.

Andrew Watt MVP

On Thu, 18 Jan 2007 16:18:04 +0800, "IT Staff" <jkklim@hotmail.com>
wrote:

>Think this shld be easy for the forum members, but i could not find any info
>on this :
>
>eg
>
>Function sum(x, y)
> return sum(x+y)
>end function
>
>How to translate to powershell function ?

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a write-multi-cell-at-once function in VBS for Excel? Tony Bansten VB Script 2 06-20-2008 06:14 PM
The disk is write-protected. Remove the write-protection or... Craig H. Foster Vista General 0 09-16-2007 11:02 AM
smart write to verbose of entering/leaving a function Serge van den Oever [Macaw] PowerShell 5 02-09-2007 10:07 PM
write host color function IT Staff PowerShell 1 01-23-2007 01:46 AM
'Write-object' is not recognized as a cmdlet, function, operable program, or script file PowershellBoy PowerShell 4 10-20-2006 10:17 PM


Update your Vista Drivers Update Your Drivers Now!!

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