ENABLEDELAYEDEXPANSION exclamation mark

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nikhiltom
Posts: 2
Joined: 30 Aug 2019 00:43

ENABLEDELAYEDEXPANSION exclamation mark

#1 Post by nikhiltom » 30 Aug 2019 00:49

Hello,

Could someone please help me how to include exclamation marks if ENABLEDELAYEDEXPANSION is enabled,

For example,

setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
for %%x in (%*) do echo %%x
pause

The above code will display the item names copied to context menu without any issues unless there's an exclamation mark in file name,

May I please know how can I print filenames including exclamation marks (!) as well (eg: name!file.txt)

Thanks

Szecska
Posts: 17
Joined: 15 Aug 2019 15:29
Location: Hungary

Re: ENABLEDELAYEDEXPANSION exclamation mark

#2 Post by Szecska » 30 Aug 2019 05:25

A similar question is being discussed:viewtopic.php?f=3&t=9250

nikhiltom
Posts: 2
Joined: 30 Aug 2019 00:43

Re: ENABLEDELAYEDEXPANSION exclamation mark

#3 Post by nikhiltom » 01 Sep 2019 07:47

Hello,

But that's about replacing the bang (!) character,

How can I include it in the echo print?

Thanks

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: ENABLEDELAYEDEXPANSION exclamation mark

#4 Post by aGerman » 01 Sep 2019 07:54

In your example you don't need ENABLEDELAYEDEXPANSION. Try with DISABLEDELAYEDEXPANSION.
Provide an example that is closer to your real code and where we can see why you actually have trouble...

Steffen

Post Reply