Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting cmd.exe /V:ON flag without starting new instance

Is there any way to enable execution-time variable expansion for cmd.exe (normally done by typing cmd /V:ON) without starting a new instance of cmd.exe?

Similarly, can other settings/flags be changed on the fly?

like image 415
Cameron Avatar asked Jan 29 '09 19:01

Cameron


People also ask

How do I duplicate in cmd?

Click Start, type cmd, and press Enter to open a command prompt window. In the Windows taskbar, right-click the command prompt window icon and select Command Prompt. A second command prompt window is opened.

What is K in cmd?

The switch /k tells Command Prompt to issue the command that follows, and then stay open so that you can view results or type followup commands. You can also use the /c switch instead /k (use only one of the switches) if you want the Command Prompt window to close after issuing the command.

What is start command in cmd?

In computing, start is a command of the IBM OS/2, Microsoft Windows and ReactOS command-line interpreter cmd.exe (and some versions of COMMAND.COM) to start programs or batch files or to open files or directories using the default program.


2 Answers

Try this:

setlocal enabledelayedexpansion

There's also

setlocal enableextensions

which is the equivalent of cmd /E:ON.

Reference: setlocal /?.

like image 177
Blorgbeard Avatar answered Dec 05 '22 22:12

Blorgbeard


Try

setlocal ENABLEDELAYEDEXPANSION
like image 32
Jason Punyon Avatar answered Dec 05 '22 22:12

Jason Punyon