Find the file extension from file name passed into powershell as a string argument
I am an absolute beginner with PowerShell,
With a pair of PS1 files.
The first one does a couple of basic checks, and will then Launch a file whose full path has been passed in as a string. $args[0]
Got that all working OK,
But the filename being passed in could be either a batch file or a PS1.
I have two problems:
How can I , within the script get the file extension from the name?
Would it be easier/better to pass the extension as another argument?
And then run the batch or the PS1 as appropriate.
If the extension is PS1 then run the PS1,
If BAT, then run the batch file