copy-item question

I’ve got the below code and I would like to change the last line of code so that the I get something like -destination $path $file

but when trying this it doesn’t seem to work can you help me out here

[pre]$path= “C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile”
$file=“VPN.xml”
if(!(Test-path -Path $path)){New-Item -ItemType directory -path $path}
if(!(Test-Path -Path $file)){Copy-Item -Path C:\Users$env:USERNAME\Downloads$file -Destination C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile,$file}
[/pre]

 

thanks

 

$path = "C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile"
$file = "C:\Users\$env:USERNAME\Downloads\VPN.xml"
if (!(Test-path -Path $path)) { 
    New-Item -ItemType directory -path $path 
}
if (!(Test-Path -Path $file)) { 
    Copy-Item -Path $file -Destination $path
}

…should work like this …

Olaf thanks for your help

 

Paul