A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

echo "one foo=bar" gives an unexpected result. Why ?



 
 
Thread Tools Display Modes
  #1  
Old March 18th 20, 12:05 PM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,052
Default echo "one foo=bar" gives an unexpected result. Why ?

Hello all.

I was thinking about how some characters are not allowed in filenames, and
tried to see if "=" is one of them.
So, I entered, on a commandline, the following: "one foo=bar".

To my surprise the contents of the file became "one =bar"

Can anybody tell me why that "one =bar" result ? (googeling is a bit hard on
it, with the lack of keywords).

Regards,
Rudy Wieser


Ads
  #2  
Old March 18th 20, 02:17 PM posted to microsoft.public.windowsxp.general
JJ[_11_]
external usenet poster
 
Posts: 701
Default echo "one foo=bar" gives an unexpected result. Why ?

On Wed, 18 Mar 2020 13:05:49 +0100, R.Wieser wrote:
Hello all.

I was thinking about how some characters are not allowed in filenames, and
tried to see if "=" is one of them.
So, I entered, on a commandline, the following: "one foo=bar".

To my surprise the contents of the file became "one =bar"

Can anybody tell me why that "one =bar" result ? (googeling is a bit hard on
it, with the lack of keywords).

Regards,
Rudy Wieser


Something is wrong with your system.

In my system...

This exact command line:

echo "one foo=bar"

It displays below line without creating any file.

"one foo=bar"

This exact command line:

"one foo=bar"

It displays below line without creating any file.

'"one foo=bar"' is not recognized as an internal or external command,
operable program or batch file.

This exact command line:

one foo=bar

It displays below lines, and creating an empty file named "foo".

'one' is not recognized as an internal or external command,
operable program or batch file.

For the last command line, "foo=bar" file is not created because the "="
character is considered as whitespace if it's not wrapped by double quotes.
  #3  
Old March 18th 20, 03:37 PM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,052
Default echo "one foo=bar" gives an unexpected result. Why ?

JJ,

So, I entered, on a commandline, the following: "one foo=bar".


My apologies, as I see that I somehow left the word "echo" out in the body
of the message, and placed the double-quotes wrong in the subjectline. :-(

The full commandline I used is (without the doublequotes ofcourse) "echo one
foo=bar"


This exact command line:

echo "one foo=bar"


:-) /allmost/ the same one.

Regards,
Rudy Wieser


  #4  
Old March 19th 20, 07:25 AM posted to microsoft.public.windowsxp.general
JJ[_11_]
external usenet poster
 
Posts: 701
Default echo "one foo=bar" gives an unexpected result. Why ?

On Wed, 18 Mar 2020 16:37:25 +0100, R.Wieser wrote:
JJ,

So, I entered, on a commandline, the following: "one foo=bar".


My apologies, as I see that I somehow left the word "echo" out in the body
of the message, and placed the double-quotes wrong in the subjectline. :-(

The full commandline I used is (without the doublequotes ofcourse) "echo one
foo=bar"


This exact command line:

echo "one foo=bar"


:-) /allmost/ the same one.

Regards,
Rudy Wieser


Two reasons:
1. The "=" character is treated as delimiters.
2. CMD processes redirection syntax first.

Thus the command line:

echo one foo=bar

CMD recognizes the " foo" syntax as redirection. It stops before the "="
delimiter. Then strips it out from the command line. After the redirection
has been processed, the command line becomes:

echo one =bar

Then that "one =bar" is outputed.

This is similar case when there's a file named "foo=bar" and below command
line is executed.

dir foo=bar

That ends up making DIR listing two files: "foo" and "bar". It's output
would be like this.

Volume in drive E is SOMETHING
Volume Serial Number is 1111-1111

Directory of E:\TEST


Directory of E:\TEST

File Not Found

Notice that it shows two "Directory of..." lines, instead of one.
  #5  
Old March 19th 20, 08:16 AM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,052
Default "echo one foo=bar" gives an unexpected result. Why ?

JJ,

(the subjectline has been corrected)

1. The "=" character is treated as delimiters.


Even on the commandline (and not just for batchfile commands) ? I never
knew that. Thanks.

dir foo=bar

That ends up making DIR listing two files: "foo" and "bar".


Which also happens with that "=" replaced by a space ... (in other words,
not something that happens because of that delimiter).

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?

Regards,
Rudy Wieser


  #6  
Old March 20th 20, 04:09 PM posted to microsoft.public.windowsxp.general
JJ[_11_]
external usenet poster
 
Posts: 701
Default "echo one foo=bar" gives an unexpected result. Why ?

On Thu, 19 Mar 2020 09:16:42 +0100, R.Wieser wrote:

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?


No idea either. There doesn't seem to be any official documentation about it
or the other semicolon and comma delimiters. Not even example of their
specific usage. The leaked Windows NT source codes may shed some light on
this issue.

CMD is a mysterious (or perhaps, buggy) command interpreter. For example, I
found that the "" character when not used for redirection, is treated as
(no quotes) "?.". And the "" character when not used for redirection, is
treated as (no quotes) "*.". At least for DIR command. e.g.

dir ^
dir ^^
dir ^
dir a^

Would be same as:

dir ?.
dir ??.
dir *.
dir a*.
  #7  
Old March 20th 20, 04:47 PM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,052
Default "echo one foo=bar" gives an unexpected result. Why ?

JJ,

No idea either. There doesn't seem to be any official documentation
about it or the other semicolon and comma delimiters.


Bummer.

For example, I found that the "" character when not used for redirection,
is treated as (no quotes) "?.". And the "" character when not used for
redirection, is treated as (no quotes) "*.". At least for DIR command.


Whut ? What good does that do (duplicating already existing functionality)
?

Its nice to be used for obsfucation though (like entering IPv4 adresses as a
single, 32-bit number).

Regards,
Rudy Wieser


  #8  
Old March 21st 20, 04:26 PM posted to microsoft.public.windowsxp.general
pyotr filipivich
external usenet poster
 
Posts: 689
Default "echo one foo=bar" gives an unexpected result. Why ?

JJ on Fri, 20 Mar 2020 23:09:43 +0700 typed in
microsoft.public.windowsxp.general the following:
On Thu, 19 Mar 2020 09:16:42 +0100, R.Wieser wrote:

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?


No idea either. There doesn't seem to be any official documentation about it
or the other semicolon and comma delimiters. Not even example of their
specific usage. The leaked Windows NT source codes may shed some light on
this issue.

CMD is a mysterious (or perhaps, buggy) command interpreter. For example, I
found that the "" character when not used for redirection, is treated as
(no quotes) "?.". And the "" character when not used for redirection, is
treated as (no quotes) "*.". At least for DIR command. e.g.

dir ^
dir ^^
dir ^
dir a^

Would be same as:

dir ?.
dir ??.
dir *.
dir a*.


cool beanz.
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #9  
Old March 21st 20, 04:26 PM posted to microsoft.public.windowsxp.general
pyotr filipivich
external usenet poster
 
Posts: 689
Default "echo one foo=bar" gives an unexpected result. Why ?

"R.Wieser" on Fri, 20 Mar 2020 17:47:47 +0100
typed in microsoft.public.windowsxp.general the following:
JJ,

No idea either. There doesn't seem to be any official documentation
about it or the other semicolon and comma delimiters.


Bummer.

For example, I found that the "" character when not used for redirection,
is treated as (no quotes) "?.". And the "" character when not used for
redirection, is treated as (no quotes) "*.". At least for DIR command.


Whut ? What good does that do (duplicating already existing functionality)?


I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #10  
Old March 21st 20, 07:10 PM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,052
Default "echo one foo=bar" gives an unexpected result. Why ?

pyotr,

but kind of a PITA as you had to learn both ways.


:-) Thats exactly what my "whut ?" was for.

Reminded me of the time I wound up trying to learn Boolean
Algebra in two separate classes, with two separate sets of notation.
I got the concepts, mostly, but still have trouble "reading" the
statements.


My favorite language (Assembly) uses one notation in the sourcecode, and
another in the resource file. I've been using the wrong one for the
thanwhile file many times. :-\

Regards,
Rudy Wieser


  #11  
Old March 23rd 20, 09:58 AM posted to microsoft.public.windowsxp.general
J. P. Gilliver (John)[_7_]
external usenet poster
 
Posts: 381
Default "echo one foo=bar" gives an unexpected result. Why ?

On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.

--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)[email protected]+H+Sh0!:`)DNAf

Once you've started swinging, chimp-like, through the branches of your family
tree, you might easily end up anywhere. - Alexander Armstrong, RT 2014/8/23-29
  #12  
Old March 23rd 20, 07:03 PM posted to microsoft.public.windowsxp.general
pyotr filipivich
external usenet poster
 
Posts: 689
Default "echo one foo=bar" gives an unexpected result. Why ?

"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".
It's been a few decades.

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).


There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.


--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #13  
Old March 24th 20, 10:16 PM posted to microsoft.public.windowsxp.general
J. P. Gilliver (John)[_7_]
external usenet poster
 
Posts: 381
Default "echo one foo=bar" gives an unexpected result. Why ?

On Mon, 23 Mar 2020 at 12:03:04, pyotr filipivich
wrote:
"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".


Ah, so it didn't _really_ have two ways of doing things (or at least
some things), just _claimed_ that it did. (I didn't spot the quote marks
in what you said the first time.)

It's been a few decades.

(-:

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).


There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.


Yes. I'm not good at learning different UIs: I'm reasonably familiar
with Windows (up to 7), but find Android (and iOS) very difficult. Which
I don't think they really are - it's just that they're very different to
what I'm used to. (W10 is also different, but in a different way.)

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.


--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)[email protected]+H+Sh0!:`)DNAf

Science fiction is escape into reality - Arthur C Clarke
  #14  
Old March 25th 20, 06:01 AM posted to microsoft.public.windowsxp.general
pyotr filipivich
external usenet poster
 
Posts: 689
Default "echo one foo=bar" gives an unexpected result. Why ?

"J. P. Gilliver (John)" on Tue, 24 Mar 2020
22:16:33 +0000 typed in microsoft.public.windowsxp.general the
following:
On Mon, 23 Mar 2020 at 12:03:04, pyotr filipivich
wrote:
"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.

Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".


Ah, so it didn't _really_ have two ways of doing things (or at least
some things), just _claimed_ that it did. (I didn't spot the quote marks
in what you said the first time.)


I do remember giving the presentation to the class and saying
something to that effect.
As I am remembering, it seemed to have two sets of codes to insert
for Italics / Bold. For some reason I'm remembering that some codes
had a "Start here" and an "end here".
Or I could be thinking of HTML, of which I've never gone into at
any great depth.
It's been a few decades.
Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).

There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.


Yes. I'm not good at learning different UIs: I'm reasonably familiar
with Windows (up to 7), but find Android (and iOS) very difficult. Which
I don't think they really are - it's just that they're very different to
what I'm used to. (W10 is also different, but in a different way.)


Yes. I'm hacking word and firefox over my wife's shoulder. as in
"Aah, try clicking on that thingy there."
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 06:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 PCbanter.
The comments are property of their posters.