Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am writing a batch file to create some secondary files but the ampersand (&) symbol is giving me some problems in the following line,
echo MbeSetAppVariable "", "msToolSettings.placeText.type", 1& >>txt_ROAD_ORIGIN.bas
is there any way to get the above line to work and also keep the ampersand (&) symbol in the results.
The following line works fine because the ampersand (&)has been removed from the line.
echo MbeSetAppVariable "", "msToolSettings.placeText.type", 1 >>txt_ROAD_ORIGIN.bas
Thank you in advance for any assistance with this problem.
Thank you in advance for any assistance with this problem.Ben

Hi Benton,
Yeah, problem is that & has special meaning in NT CMD.
This "works" but you get the double quotes in the BAS:
C:\temp\-\amp>echo "MbeSetAppVariable "", "msToolSettings.placeText.type", 1 &"
>>txt_ROAD_ORIGIN.basI wondered if this could be gotten around by starting a COMMAND shell where, I'd think, & has no special meaning. Still got the error.
M2
If at first you don't succeed, you're about average.

I think this will need to be worked around.
You could use:
And in your echo line use a string like ###, then:
change txt_ROAD_ORIGIN.bas "###" "&"
M2
If at first you don't succeed, you're about average.

I tried your suggestion by creating a line like this;
echo MbeSetAppVariable "", "msToolSettings.placeText.type", 0### >>txt_ROAD_ORIGIN.bas
and then created another batch file with the following in it;
change txt_ROAD_ORIGIN.bas "###" "&"
I placed the change.com file in the same folder.
It didnt produce any results is there something that I have done wrong.
Thank You
Ben

Usually when CHANGE runs [actually always] it will give a result of either "changed" or "not changed".
"It didnt produce any results"
Well, either it did the change or it did not.
You can test this with a trivial testfile:
::====================
@echo off
echo one > testfile
change testfile "one" "two"
echo.
type testfile
::=====================
M2
If at first you don't succeed, you're about average.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |