Tenzin
Tenzin

Reputation: 2505

Set local variable without deleting it when computer goes off-line

I need to set a local variable. I know I can use: set dummyX=C:\Program Files (x86)

But how do I make it this way that when a computer goes offline, the variable is remembered?

Upvotes: 1

Views: 26

Answers (1)

npocmaka
npocmaka

Reputation: 57282

SETX

if not defined dummyX (
    setx dummyX "C:\Program Files (x86)"
    set " dummyX=C:\Program Files (x86)"
)

you need both setx and set because setx takes effect after the cmd.exe is started again.

Upvotes: 2

Related Questions