Author Posts

April 10, 2015 at 2:11 pm

i have 5 functions copy-files, compare-files, alert-users, zip-files and remove-files.

they look like this:
function copy-file {
param ($a,$b)
copy-item $a $b
}

how do I create 1 script, that will go through the entire functionslist one after the other?

April 10, 2015 at 2:19 pm

You define functions in first place and then you call them 🙂
Or I missed your point in question?

April 10, 2015 at 9:01 pm

Hey Sanjaya,

You'd want to do something like this


Param(
    [string]$a,
    [string]$b
)

function copy-file 
{
    param ($a,$b)
    Copy-Item $a $b
}

#put your functions here e.g.

function functionname
{
    param ($a,$b)
    command $a $b
}
.
.
.
#put your other commands here including the parameters, like :
copy-file -a $a -b $b