Use Variable in eventcreate batch file?

Viewed 24

I need to tweak an eventcreate statement in an existing, but antique, batch file, to include a variable in the event log.

I've tried multiple ways but can't get it to work.

The statement currently looks something like this:

eventcreate /SO "batch file name" /Id 999 /D "specific event" /T INFORMATION /L Application

I need to include the value of a variable in the description like this:

eventcreate /SO "batch file name" /Id 999 /D "variable value is %%test%%" /T INFORMATION /L Application

I tried placing that variable outside the quotes, but the event log entry shows the variable name, but does not replace it with the actual value of the variable.

Anyone know if this can be done?

1 Answers

/D description Specifies the description text for the new event. (c) eventcreate /?

it isn't working that you think (variable escape once) use %test% without %%test%%

"self-updated description"? I don't understand you. please update this question / left a comment / try %var%

maybay %test% isn't contained some value? (isn't variable)

check %ProgramFiles% without %%test%% it's work

Related