I would like to check if a file exists (that contains command line parameters) before parsing the command line options. If I have the following at the top of my ps1 script:
param (
[string]$server,
[string]$username,
)
Any code before the param will cause the param to throw an error. What I would like to do is check the presence of a file in the current directory. If it's there, skip the parameters, otherwise, continue on. Is there a way to put code before the param call, or does it have to be the first line of the file?
Thanks!