Multiple strings params by alanrenouf 26 months ago
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1512"></script>download | new post
Multiple string parameters
- # For example I have this function
- function copySourceDestination {
- Param (
- [string]$sourceFile,
- [string]$destinationPath
- )
- # Strangely enough $sourceFile will contain both the values of $sourceFile and $destinationPath
- # in this case $destinationPath will be empty and $sourceFile will show up as: "C:\bla.txt \\server\share\path"
- Copy-Item -Path:$sourceFile -Destination:$destinationPath -Force
- }
- # Calling the function
- copySourceDestination "C:\bla.txt" "\\server\share\path"
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository