Problem with alias

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
chantling
GamingTools Subscriber
Posts: 4
Joined: Thu Jan 27, 2011 7:47 pm

Problem with alias

Post by chantling » Sun Aug 05, 2012 8:43 pm

I want to run a program located outside of the \.net programs\ folder (keep the main branch in that folder, have a test folder for experimental builds). The following command works properly from the console and launches the test version of my program:

Code: Select all

dotnet myprogram d:\\myprogram\\test\\myprogram.exe
I'd like to set up an alias, however, rather than type all of that every time. I've got a couple of aliases already set up in the startup section of the game's (eve) config in the uplink - since the programs referenced are in the \.net programs\ folder, it's just "alias myprogram dotnet myprogram myprogram". In the console, I type "myprogram" and I'm good to go. I can't set up the alias for the test program located in a different folder, though. No matter what I try, I get exceptions: "Illegal characters in path".

I've tried:

Code: Select all

alias myprogramtest dotnet myprogram d:\\myprogram\\test\\myprogram.exe
alias myprogramtest dotnet myprogram"d:\\myprogram\\test\\myprogram.exe"
alias myprogramtest dotnet myprogram \"d:\\myprogram\\test\\myprogram.exe\"
Can somebody point out what I'm doing wrong?

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Mon Aug 06, 2012 6:54 am

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

chantling
GamingTools Subscriber
Posts: 4
Joined: Thu Jan 27, 2011 7:47 pm

Post by chantling » Mon Aug 06, 2012 9:13 pm

Awesome, that worked for me. I didn't know about the forward slash. Thank you.

Post Reply