Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Replacing a file by creating a function

$
0
0

Good Afternoon 

I have a config file that i need to replace anytime a user wants to switch from dev and uat

I tried creating a function so that users can just type set_dev and set_uat and it will replace that file that needs to be replaced but what I'm receiving is "Copy-Item : Cannot bind argument to parameter 'Path' because it is null.

At line:15 char:16"

 

 

Below is the script any help will be greatly appreciated, Thank you. 

$destuat= "C:\Python27\pyxll-2.2.1-x86-py27"

$sourceuat= "\\dactoco.com\cap\Software\PyXLL\CTP32bit\pyxll_uat\pyxll.cfg"

$sourcedev= "C:\Python27\pyxll-2.2.1-x86-py27"

$destdev= "\\dactoco.com\cap\Software\PyXLL\CTP32bit\pyxll_dev\pyxll.cfg"

 

function set_uat

{

param($destuat, $sourceuat)

Copy-Item -Path $sourceuat -Destination $destuat -Force

}

 

function set_dev

{

param ($destdev, $sourcedev)

Copy-Item -Path $sourcedev -Destination $destdev -Force

 

}


Viewing all articles
Browse latest Browse all 6937

Trending Articles