I am currently learning about Powershell and how to write a script to launch an application. The following snippet of code I borrowed and have modified to learn how to launch notepad. The question I have is what does $args.Clone()
do or derive from? (It is from the original code which had a different path and executable program being defined/called.) I realize that the variable $myArgs is being initialized to the left of the equal sign by the function on the right. However, I have not been successful finding resources about what can you can do with .Clone()
so I thought I would try and ask here.
BTW, the script works as it launchs notepad.exe and names the text file 'pp'. If the file has not previously been created, it asks me if I want to name the text file 'pp'.
$exePath = $env:NOTEPAD_HOME + '/Windows/notepad.exe'
$myArgs = $args.Clone()
$myArgs += '-pp'
$myArgs += $env:NOTEPAD_HOME
& $exePath $myArgs