I would like my command line program to take file parameters in the form:
-out:%MyDocuments%\dummy.xps
and having %MyDocuments% automatically replaced with:
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
I know it’s an easy to write function, but I guess it should be already done somewhere, so I don’t want to re-invent the wheel.
You can use
Environment.ExpandEnvironmentVariables(variable);The input doesn’t need to be a single variable, it can be a ‘query’, like your path, with variables embedded and it will expand all those it finds/recognises. This is shown in the snippet at the link given: