Q:

escape characters in variables in a batch script

I have i.a. variables like:
SET CURRHOST=myServer
SET CURRCOMPANY=myCompany
SET CURRDB=string!string=string!string=string

after I set this variable:
SET NAME=%CURRHOST%\%CURRCOMPANY%\%CURRDB%

I also used the variables above in other variables. But my problem is now, that the script thinks that my CURRDB variable is a command.
I tried to escape the variable like
SETLOCAL ENABLEDELAYEDEXPANSION
SET CURRDB=string^^!string^^=string^^!string^^=string

and then use this variable in other variables with
!CURRDB!

But it does not work. It also removes the ! character and the string between the = character. 
So how can I escape this characters in the CURRDB variable.
EDIT:
what I am trying to do exaktly:
SETLOCAL ENABLEDELAYEDEXPANSION
set CURRHOST=myServer
set CURRCOMPANY=myCompany
set CURRDBASE=string!string=string!string=string
set CURRSQLCMD="C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn"
set CURRFILETREE=E:\SWF_DBankBackup\MSSQL2012

After I use these variables obove for other variables:
set DateiName=%CURRHOST%_%CURRDBASE%_BackupCurrent
set Backuppath=%CURRFILETREE%\%CURRCOMPANY%\%CURRDBASE%
set BackupSkript=%Backuppath%\BackupCurrentScript\%DateiName%_Full_Script.sql
set BackupBAKpath=%Backuppath%\Current
set BackupTXTpath=%Backuppath%\Current\txt

But the Problem is the variable CURRDB. The script handles it as a command because of the characters ! and = in the string. So I get an error that in cmd 'testtest' is not recognized as an internal or external command, operable programm or batch file. So it seems like that the script removes the ! and the = from the variable.
So how can I escape the ! and the = in the variable?

A:

Your escaping seems to work on my end. Could it be you're using the percent sign % for the constructed variable? Check this:
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET CURRHOST=myServer
SET CURRCOMPANY=myCompany
SET CURRDB=string^^!string=string^^!string=string

ECHO correct: %CURRHOST%\%CURRCOMPANY%\!CURRDB!
ECHO broken : %CURRHOST%\%CURRCOMPANY%\%CURRDB%

SET NAME=%CURRHOST%\%CURRCOMPANY%\!CURRDB!

ECHO correct: !NAME!
ECHO broken : %NAME%

Outputs:
correct: myServer\myCompany\string!string=string!string=string
broken : myServer\myCompany\stringstring=string
correct: myServer\myCompany\string!string=string!string=string
broken : myServer\myCompany\stringstring=string

The broken strings exactly match the misbehaviour you describe.
Delayed expansion isn't exactly easy to get your head around and the official documentation is mostly bad. I'd recommend reading on SS64, here's their page on delayed expansion.

