I would actually suggest just using forward slashes which is the preferred method of simplifying this in LavishScript.
This is probably fine:
Code: Select all
alias myprogramtest dotnet myprogram "d:/myprogram/test/myprogram.exe"
But let me try to clear some things up for you. First of all, let's make this less about aliases. When you make your alias, it tells you what command it will perform.
Code: Select all
myprogramtest=dotnet myprogram d:\myprogram\test\myprogram.exe
You can test this command without using the alias system. Try entering this command yourself:
Code: Select all
dotnet myprogram d:\myprogram\test\myprogram.exe
Indeed, entering this command in the console results in the described exception, regardless of whether the path exists.
Code: Select all
Unhandled exception in application.
Outer Exception: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
However, entering the same command with forward slashes works as intended:
Code: Select all
dotnet myprogram d:/myprogram/test/myprogram.exe
Or alternatively, double backslashed will work as intended as well:
Code: Select all
dotnet myprogram d:\\myprogram\\test\\myprogram.exe
About Quotes: Quotes are needed in a command when you would like one parameter to include a space (the parameter splitter) or a ; (the command splitter). Your parameter uses neither, so quotes in this case are not absolutely necessary but can be used. Either way, you want a space after the previous parameter, before the quote. Otherwise your one parameter is
myprogram"d:\\myprogram\\test\\myprogram.exe".
About Backslashes: Backlashes \ are an escape character. When you do a command, a layer of backslashes are removed (one backslash is turned into something else depending on what comes after it;
every two backslashes are turned into one backslash). Alias is not re-escaping the command for you, so you would need to use another layer of slashes to make the alias show, and later perform, the double-escaped command. Like this:
Code: Select all
alias myprogramtest dotnet myprogram d:\\\\myprogram\\\\test\\\\myprogram.exe