Page 1 of 1
Problems with multiple filenames on command line
Posted: Sun Oct 13, 2019 10:30 am
by john1857
Using Textpad 8.2, Win10, 64-bit.
I can't get multiple filenames to work on the command line.
I type:
I get:
Code: Select all
OK to create 'C:\Users\john\x.txt y.txt'
If I say "yes" a file called "x.txt y.txt" is created.
According to the help file, this is the behaviour I would expect if I were using the "-u" switch.
More confusingly:
If I type:
Code: Select all
"C:\Program Files\Textpad 8"\textpad.exe x.txt
I get:
Code: Select all
OK to create 'C:\textpad.exe x.txt'
Something seems to be badly wrong with the command line parsing...
Posted: Sun Oct 13, 2019 12:51 pm
by ben_josephs
In Configure | Preferences | General
set Allow multiple files on the command line
and close TextPad.
The -u option just allows you to omit the quotes if a filename contains spaces.
I can't reproduce your other problem. It doesn't look like a TextPad issue.
Posted: Sun Oct 13, 2019 3:11 pm
by john1857
ben_josephs wrote:In Configure | Preferences | General
set Allow multiple files on the command line
and close TextPad.
Thanks!
I can't reproduce your other problem. It doesn't look like a TextPad issue.
Here's a screenshot showing it happening:

Posted: Sun Oct 13, 2019 3:12 pm
by john1857
ben_josephs wrote:In Configure | Preferences | General
set Allow multiple files on the command line
and close TextPad.
Thanks!
I can't reproduce your other problem. It doesn't look like a TextPad issue.
Here's a screenshot showing it happening:

Posted: Sun Oct 13, 2019 3:13 pm
by john1857
ben_josephs wrote:In Configure | Preferences | General
set Allow multiple files on the command line
and close TextPad.
Thanks!
I can't reproduce your other problem. It doesn't look like a TextPad issue.
Here's a link to a screenshot showing it happening:
https://www.dropbox.com/s/mlzdr1utvzz9ekz/bug.jpg?dl=0
(Can't include this as an img for some reason...)
Posted: Sun Oct 13, 2019 7:12 pm
by ben_josephs
Ah. I just tried it with CMD (not a shell I normally use). I see what you see now. But this works:
Code: Select all
"C:\Program Files\Textpad 8\textpad.exe" x.txt
So it's a CMD bug. Who'd've thought?
Posted: Sun Oct 13, 2019 8:19 pm
by MudGuard
in my opinion it is a windows bug - allowing spaces in file names ...
Posted: Sun Oct 13, 2019 9:26 pm
by ben_josephs
In Unix/Linux you can use almost any ASCII character in a file or directory name. The difference is that Unix/Linux people, being command-line aware, have enough sense not to do that.
Posted: Mon Oct 14, 2019 9:45 am
by john1857
ben_josephs wrote:Ah. I just tried it with CMD (not a shell I normally use). I see what you see now. But this works:
Code: Select all
"C:\Program Files\Textpad 8\textpad.exe" x.txt
So it's a CMD bug. Who'd've thought?
Is it really a CMD bug? I normally use 4NT ot TCMD, and they do the same thing.
I wrote a little C program to test this:
Code: Select all
#include <stdio.h>
int main(int argc, char** argv) {
for (int i = 0; i < argc; i++) {
printf("[%s] ",argv[i]);
}
printf("\n");
return 0;
}
This is the output it produces in various test cases:
Code: Select all
C:\Users\JE\Desktop\Test dir> a.exe x y
[a.exe] [x] [y]
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir"\a.exe x y
[C:\Users\JE\Desktop\Test dir\a.exe] [x] [y]
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir\a.exe" x y
[C:\Users\JE\Desktop\Test dir\a.exe] [x] [y]
I made sure to use a directory with a space in the name. Notice that the output for the second and third cases are the same, despite the difference in quoting.
So it definitely is
Not a CMD bug.[/b]
Posted: Mon Oct 14, 2019 9:45 am
by john1857
ben_josephs wrote:Ah. I just tried it with CMD (not a shell I normally use). I see what you see now. But this works:
Code: Select all
"C:\Program Files\Textpad 8\textpad.exe" x.txt
So it's a CMD bug. Who'd've thought?
Is it really a CMD bug? I normally use 4NT ot TCMD, and they do the same thing.
I wrote a little C program to test this:
Code: Select all
#include <stdio.h>
int main(int argc, char** argv) {
for (int i = 0; i < argc; i++) {
printf("[%s] ",argv[i]);
}
printf("\n");
return 0;
}
This is the output it produces in various test cases:
Code: Select all
C:\Users\JE\Desktop\Test dir> a.exe x y
[a.exe] [x] [y]
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir"\a.exe x y
[C:\Users\JE\Desktop\Test dir\a.exe] [x] [y]
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir\a.exe" x y
[C:\Users\JE\Desktop\Test dir\a.exe] [x] [y]
I made sure to use a directory with a space in the name. Notice that the output for the second and third cases are the same, despite the difference in quoting.
So it definitely is NOT a cmd bug.[/b]
Posted: Mon Oct 14, 2019 9:50 am
by john1857
ben_josephs wrote:Ah. I just tried it with CMD (not a shell I normally use). I see what you see now. But this works:
Code: Select all
"C:\Program Files\Textpad 8\textpad.exe" x.txt
So it's a CMD bug. Who'd've thought?
Is isn't a CMD bug? I normally use 4NT or TCMD, and they do the same thing.
I wrote a little C program to test this:
Code: Select all
#include <stdio.h>
int main(int argc, char** argv) {
for (int i = 0; i < argc; i++) {
printf("(%s) ",*argv++);
}
printf("\n");
return 0;
}
This is the output it produces in various test cases:
Code: Select all
C:\Users\JE\Desktop\Test dir> a.exe x y
(a.exe) (x) (y)
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir"\a.exe x y
(C:\Users\JE\Desktop\Test dir\a.exe) (x) (y)
C:\Users\JE\Desktop\Test dir> "C:\Users\JE\Desktop\Test dir\a.exe" x y
(C:\Users\JE\Desktop\Test dir\a.exe) (x) (y)
I made sure to use a directory with a space in the name. Notice that the output for the second and third cases are the same, despite the difference in quoting.
So it definitely is NOT a bug in CMD/4NT/TCMD.[/b]
Posted: Mon Oct 14, 2019 9:54 am
by john1857
Apologies for posting everything twice. It keeps giving me an error message when I press submit:
Code: Select all
Couldn't get mail server response codes
DEBUG MODE
Line : 185
File : smtp.php
which I thought might be due to square brackets in my test program and output, so I tried again with parentheses... it posted successfully both times despite the error message.
Posted: Mon Oct 14, 2019 4:55 pm
by ben_josephs
I use TCC (v 20), which succeded 4NT many years ago. It works as I described in my installation of TCC. (TCMD is not relevant here.)
Your C program shows that by the time the command line has been processed by the parser of your version of 4NT and your version of C run-time library, the quotes have gone.
There are other shells and other RTLs...
Posted: Tue Oct 15, 2019 6:26 am
by AmigoJack
john1857 wrote:I type:
I get:
Code: Select all
OK to create 'C:\Users\john\x.txt y.txt'
Strictly speaking each program on its own can decide how to treat its command line. Most programs adhere to the space being a parameter delimiter (unless quotes are used), but there's no guarantee for you.
john1857 wrote:If I type:
Code: Select all
"C:\Program Files\Textpad 8"\textpad.exe x.txt
I get:
Code: Select all
OK to create 'C:\textpad.exe x.txt'
Again, this is the program's fault, not adhering to the common use of quotes only escaping spaces, not being seen as delimiters, too.
john1857 wrote:I wrote a little C program to test this
This already relies on a parsed command line - write a program that parses the command line itself.