Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Command Line: Non Evaluation of Environment Variable

I would like to provide the raw text referring to an environment variable to a command instead of evaluating the environment variable.

I need this to configure BizTalk from the command line, for example:

BTSTask.exe AddResource -ApplicationName:App1 -Type:System.BizTalk:BizTalkAssembly -Overwrite -Source:..\Schemas\bin\development\App1.Schemas.dll -Destination:%BTAD_InstallDir%\App1.Schemas.dll

This command adds a resource to a BizTalk application. I want the destination to be %BTAD_InstallDir%\App1.Schemas.dll, however at present it is evaluating the environment variable (to nothing) and using \App1.Schemas.dll.

Is it possible to escape or disable the evaluation of this environment variable while parsing\executing this command?

I have tried escaping the first and both percentage characters with a carrot (^), however this did not stop the evaluation.

[EDIT] When I execute this at the command prompt it doesn't replace the environment variable, however it does when I run it as a script, any thoughts as to why this is different?

like image 919
marcj Avatar asked Nov 27 '08 10:11

marcj


1 Answers

Try echo ^%path^% in a command prompt it prints...

path

instead of expanding the environment variable so I guess the following should work for you as suggested by Mikeage

BTSTask.exe AddResource -ApplicationName:App1 -Type:System.BizTalk:BizTalkAssembly -Overwrite -Source:..\Schemas\bin\development\App1.Schemas.dll -Destination:^%BTAD_InstallDir^%\App1.Schemas.dll

like image 104
Autodidact Avatar answered Oct 07 '22 18:10

Autodidact