+-Spaces in command line, between parameters
Moderators: Hacker, petermad, Stefan2, white
+-Spaces in command line, between parameters
This is not a problem with spaces in file names (as discussed somewhere here), but with spaces in the command string.
Tested with TC 8.50 Beta 13. Commands in red lines don't work. Launch in the command line:
cd C:\WINDOWS\NOTEPAD.EXE
cd "C:\WINDOWS\NOTEPAD.EXE"
cd C:\WINDOWS\NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "C:\WINDOWS\NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
When inside C:\WINDOWS directory:
cd NOTEPAD.EXE
cd "NOTEPAD.EXE"
cd NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
I suppose that TC could safely ignore additional spaces between command line parameters. Such spaces are sometimes inserted when pasting command parts from some text file or a console window.
Regards
Tested with TC 8.50 Beta 13. Commands in red lines don't work. Launch in the command line:
cd C:\WINDOWS\NOTEPAD.EXE
cd "C:\WINDOWS\NOTEPAD.EXE"
cd C:\WINDOWS\NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "C:\WINDOWS\NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
When inside C:\WINDOWS directory:
cd NOTEPAD.EXE
cd "NOTEPAD.EXE"
cd NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
I suppose that TC could safely ignore additional spaces between command line parameters. Such spaces are sometimes inserted when pasting command parts from some text file or a console window.
Regards
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Spaces at the beginning are not ignored, so you can enter paths starting with a space. Of course it makes little sense to ignore them also when they are in front of " or a drive letter, but there are too many such cases to handle them all. The user will see his error and retry with the correct name.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
I appreciate this function of TC, when cd command tries to fit path+filename with spaces, but without doublequotes. I use this function quite often.
This function would be even better, when ignoring spaces when, as you said, it is clear that these spaces are meaningless, i.e. before drive letter, " or \\. This would solve problems shown in 1-st and 3-rd red line.
Besides, to make it better one more time, TC could also try go to "NOTEPAD.EXE", when going to " NOTEPAD.EXE" (with some spaces at the beginning) failed. This would also solve problem shown in 2-nd red line.
This function would be even better, when ignoring spaces when, as you said, it is clear that these spaces are meaningless, i.e. before drive letter, " or \\. This would solve problems shown in 1-st and 3-rd red line.
Besides, to make it better one more time, TC could also try go to "NOTEPAD.EXE", when going to " NOTEPAD.EXE" (with some spaces at the beginning) failed. This would also solve problem shown in 2-nd red line.
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
OK, I have changed this partially now: Leading spaces will be ignored when followed by a double quote ". Otherwise they will be treated as part of the directory name.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Tested with TC 8.50 Beta 14:
cd C:\WINDOWS\NOTEPAD.EXE
cd "C:\WINDOWS\NOTEPAD.EXE"
cd C:\WINDOWS\NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "C:\WINDOWS\NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
When inside C:\WINDOWS directory:
cd NOTEPAD.EXE
cd "NOTEPAD.EXE"
cd NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
As I understand, the red case is by design now.
So can be moved to "fixed".
cd C:\WINDOWS\NOTEPAD.EXE
cd "C:\WINDOWS\NOTEPAD.EXE"
cd C:\WINDOWS\NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "C:\WINDOWS\NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
When inside C:\WINDOWS directory:
cd NOTEPAD.EXE
cd "NOTEPAD.EXE"
cd NOTEPAD.EXE (2 spaces between cd and file name, which not visible here)
cd "NOTEPAD.EXE" (2 spaces between cd and file name, which not visible here)
As I understand, the red case is by design now.
So can be moved to "fixed".
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, the red case is by design! It allows to launch files with leading spaces without the need to use double quotes.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com