I have been asked to review and edit, if needed, some scripts. I have entered the relevant part of this one below. I believe its correct, but I cannot figure out if the period at the beginning of the second to last line is needed or just a typo. It appears to be a source operator, but I don't see why it'd be needed there.
As always, you folks here are the salt of the earth and deserve much more plaudits than you get and than I can give. Thank you so much for continuing to making me look better at this than I am.
$Assembly = 'D:\MgaLin2.dll'
."C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" -codebase -tlb $Assembly
Copy-Item -Path D:\Mga -Destination "C:\Program Files (x86)\Common Files\COMPANY_NAME\COMPANY_SUBFOLDER\" -Include *.*
The use of a period (
.) (the dot-sourcing operator) is unusual in this case, but it works.More typically, you'll see use of
&, the call operator in this situation.Only for PowerShell scripts (and script blocks,
{ ... }) does the distinction between.and&matter (.then dot-sources the code, i.e. runs it directly in the caller's scope rather than in a child scope, as&does).For external programs, such as
RegAsm.exe, you can technically use.and&interchangeably, but to avoid conceptual confusion, it is best to stick with&.Note that the reason that
&(or.) is required in this case is that the executable path is quoted; the same would apply if the path contained a variable reference (e.g.,$env:ProgramFiles) or a subexpression (e.g.,$($name + $ext)).For more information about this requirement, which is a purely syntactic one, see this answer.