Solved Why exclamation mark does not shown ?

August 12, 2018 at 01:15:58
Specs: Windows XP Pro, P4 3GHz/1.5GB
After running this batch file, exclamation mark disappear.

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO. "Pictures !of family!"

the output is
"Pictures "
not what it should be
"Pictures !of family!"

Mr. Adel


See More: Why exclamation mark does not shown ?

Reply ↓  Report •

✔ Best Answer
August 12, 2018 at 10:27:03
Remove this line: SETLOCAL ENABLEDELAYEDEXPANSION

Otherwise use a better scripting language. If the target box is really WinXP, the better language would be VBScript.

How To Ask Questions The Smart Way



#1
August 12, 2018 at 01:53:49
Because you have enabled delayed expansion you need to escape the exclamation mark. Try:

ECHO "Pictures ^^!of family^^!"


Reply ↓  Report •

#2
August 12, 2018 at 03:05:51
Thanks for your prompt answer.
----
ECHO "Pictures ^^!of family^^!"
"Pictures ^"
----
does not work
but
----
ECHO "Pictures ^!of family^!"
"Pictures !of family!"
---
but this is OK

Actually my problem is, when i am reading from a text file which had more lines with ! ,
so i can not edit it.

Mr. Adel


Reply ↓  Report •

#3
August 12, 2018 at 06:03:58
If you want to escape the ! you do it with nSINGLE carets:

ECHO. "Pictures ^!of family^!"

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

Related Solutions

#4
August 12, 2018 at 09:53:35
Sorry, my real problem is reading from a file contains Exclamation Mark, where i can not edit the reading file.

Mr. Adel


Reply ↓  Report •

#5
August 12, 2018 at 10:27:03
✔ Best Answer
Remove this line: SETLOCAL ENABLEDELAYEDEXPANSION

Otherwise use a better scripting language. If the target box is really WinXP, the better language would be VBScript.

How To Ask Questions The Smart Way


Reply ↓  Report •

#6
August 12, 2018 at 11:45:53
Can you explain why you have set ENABLEDELAYEDEXPANSION? Are there more constraints that you haven't yet told us about?

Reply ↓  Report •

#7
August 12, 2018 at 11:50:03
Razor2.3 August 12, 2018 at 10:27:03

Otherwise use a better scripting language
------------------
that is better.

Mr. Adel


Reply ↓  Report •

Ask Question