FG
💻 Software

Setting and using variable within same command line in Windows cmd.exe

Fresh5 days ago
Mar 15, 2026154686 views
Confidence Score1%
1%

Problem

In Bash, I can do and will be run with set to , but this won't affect the value of in the shell itself. Is it possible to do this in ?

Error Output

EDITOR=vim command

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Setting and using variable within same command line in Windows cmd.exe

Low Risk

Note that would not work. Nor would You would need: the option, to enable delayed environment variable expansion using as delimiter. no space between a command and the (or add quotes) That is: As noted below by maoizm, it is , not (which would not work) I can't think of any practical reason you'd ever actually want this within the context of a single command Typically, you need this when you have to replace a value used multiple times in a long command line. For instance, to deploy a file to Ne…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment