PoshCode Archive  Artifact [bafb90ee36]

Artifact bafb90ee3648a46ffef813ffa63cfee1007cce0181e696cc52c0978e1cd8b83d:

  • File Multiple-strings-params.ps1 — part of check-in [dff0576eb7] at 2018-06-10 12:57:57 on branch trunk — Multiple string parameters (user: unknown size: 738)

# encoding: ascii
# api: powershell
# title: Multiple strings params
# description: Multiple string parameters
# version: 0.1
# type: function
# license: CC0
# x-poshcode-id: 1512
# x-archived: 2009-12-12T18:33:54
#
#
# 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"