Windows Command Prompt: No Environment Variable Evaluation

I would like to provide the source code referencing the environment variable to the 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 the resource to the BizTalk application. I want the destination to be% BTAD_InstallDir% \ App1.Schemas.dll, however, it currently evaluates the environment variable (to nothing) and uses \ App1.Schemas.dll.

Is it possible to avoid or disable the evaluation of this environment variable during analysis \ execution of this command?

I tried to slip away from the first and both percentages with a carrot (^), however this did not stop the evaluation.

[EDIT] When I execute this on the command line, it does not replace the environment variable, however, when I run it as a script, any thoughts on why this is different?

+5
source share
4 answers

Have you tried:

%%BTAD_InstallDir%%

in script?

This should prevent the script from interpreting the variable and passing it to it %BTAD_InstallDir%.

+3
source

Try echo ^% path ^% on the command line it prints ...

way

instead of expanding the environment variable, so I think the following should work for you: Mikeage

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

+4

Try %% instead of%.

+2
source

I tried:

C:\PrgCmdLine\Unix\echo.exe "%"JAVA_HOME"%"

Got:

%JAVA_HOME%

[EDIT] Indeed, it C:\PrgCmdLine\Unix\echo.exe ^%JAVA_HOME^%works too, and easier ...

[EDIT 2] For the record: I used the echo of UnxUtils to have the behavior of a simple program. The built-in echo has slightly different behavior, at least for quoted% signs.

+1
source

All Articles