-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle quoted paths #398
Handle quoted paths #398
Conversation
I was annoyed at having to use short paths all the time in my aliases. It wasn't until I found a command that actually refused to work with a shortpath (running iisexpress.exe) I was determined to find a solution. It appears that the reason the quoted paths weren't working was due to the ::validate alias stuff. The for command would stumble on a quoted path, arguing that /foo was unexpected... The additions on lines 7-8 wrap the input in quotes and then strip the inner quotes. This variable is used in the for loop (instead of %*) for validating the alias. So long as the alias is valid (contains no spaces) then the existing method of appending the new alias to the aliases file works just fine because it still uses %*.
Accidentally sent a pull request yesterday to master. Sorry for the noob maneuver. Hopefully this PR is better. |
|
||
set _temp=%_temp2: =% | ||
:: validate alias | ||
for /f "delims== tokens=1" %%G in ("%_x%") do set alias=%%G |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, since %_x%
usage is not needed in arguments check (line 10) then it is better to move its definition to actual usage here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the %_x% is needed in the arguments check, the declaration must remain at the top of the file.
👍 |
@mikesigs can you rebase, please? |
Conflicts: bin/alias.bat
@Stanzilla Done and done. |
I was annoyed at having to use short paths all the time in my aliases. It wasn't until I found a command that actually refused to work with a shortpath (running iisexpress.exe) I was determined to find a solution.
Quoted paths weren't working whenever the script used "%*". You'd get an error like "File was unexpected at this time."
The additions on lines 6-7 wrap the input in quotes and then strip the inner quotes. This variable is used in the for loop (instead of %*) for validating the alias. It's also used in the first usage check.
I also renamed a variable and indented a couple things.
The command I used as my test was:
alias runapi=runas /netonly /user:domain\user "c:\Program Files (x86)\IIS Express\iisexpress.exe /site :WebAppName /trace:i"