Variables for DOS parameters with function

by Apr 23, 2013

Hi,

I would like to create a function with dos command(xcopy) and to create for this DOS command paramaters in variables (

original dos command with paramters: "xcopy C:TempForce2.csv C:ssm /S /E >>c:Tempxcopylog.txt"

) something like this:

function copyonefile {
$source = "C:TempForce2.csv"

$destination = "C:ssm"
$options = "/S /E"
$log = ">>c:Tempxcopylog.txt"
$argarray = @("$source","$destination","$options","$log")
C:WindowsSystem32xcopy.exe $argarray }

Unfortunately, it's not working, can you advise?