Skip to main content

All Questions

15 votes
1 answer
25k views

Why unload variables in Windows batch files

Is it considered necessary or good practice to unload variables used in Windows batch files? For example in the following code, is the set myFolder= at the end necessary? @echo off set myFolder="C:\...
ChrisB's user avatar
  • 1,626
9 votes
2 answers
13k views

Set and print content of environment variable in cmd.exe subshell?

Consider this example, where I start a new "sub" instance of cmd.exe, and then try to set a new environment variable in it, and then check if it has the proper value set (this is in cmd.exe of Windows ...
sdbbs's user avatar
  • 1,402
8 votes
7 answers
28k views

WMIC output property value without property name

I'm entering something like that Desktop>wmic environment where(name="PATH" and systemVariable=FALSE) get variableValue VariableValue xxx But I don't want VariableValue to get into output. I want ...
Paweł Audionysos's user avatar
8 votes
1 answer
21k views

Enable-WindowsOptionalFeature is not recognized in Windows 10

When I try to run Enable-WindowsOptionalFeature windows throws ''Enable-WindowsOptionalFeature' is not recognized as an internal or external command, operable program or batch file.' I am running ...
andgate's user avatar
  • 99
7 votes
2 answers
3k views

How do I keep each PATH entry only once?

I have just tried to add something to my PATH and realized it grew out of proportions because of duplicates: C:\Users\user>setx Path "%Path%;C:\Python34" WARNING: The data being saved is truncated ...
Dmitry Grigoryev's user avatar
6 votes
3 answers
14k views

Using setx to append to user PATH

My attempt: setx PATH "%PATH%;%~dp0" How do I do this without everything in system PATH getting duplicated in user PATH?
J.Doe's user avatar
  • 75
4 votes
1 answer
128 views

Using a system variable with spaces without truncating prematurely

I need to do something similar to this: dir > %USERNAME%.txt But what I get is that if the filename has a SPACE(" ") in it, then the name is cut there. I know that if I do this: set tmp=%...
Diga's user avatar
  • 43
4 votes
2 answers
9k views

Write multi-line variable to .txt (CMD, NO .bat)

I'm successfully splitting %PATH% into multiple lines like this set t=%PATH:;=^&echo.% then this displays each path in new line nicely, just as I want: echo %t% However when I want to write ...
Paweł Audionysos's user avatar
4 votes
2 answers
447 views

How do I persist windows variables set in a CMD file?

in windows I would like to have a cmd script that I can run which sets an environment variable. The variable should still be set after the script executes. The variable is a token of sorts and is ...
George's user avatar
  • 181
4 votes
2 answers
1k views

PATHEXT environment variable not working

I want to use gcc on Windows, so someone gave me a MinGW folder. I put the D:\software\MinGW\bin\ folder in my PATH. But when I open a new CMD and type gcc, I get 'gcc' is not recognized as an ...
JacopoStanchi's user avatar
3 votes
2 answers
11k views

youtube-dl 'youtube-dl' is not recognized as an internal or external command, operable program or batch file

I have already added the path to environment path variable. But when I tried to execute it through cmd . I am getting the error 'youtube-dl' is not recognized as an internal or external command, ...
Aman's user avatar
  • 169
3 votes
2 answers
2k views

Name "wmplayer" is not recognized as an executable file

I cannot run wmplayer from either cmd or PowerShell. My OS is Windows 7 64 bit. I can do it using start wmplayer but I cannot use parameters. Please, help me to handle it.
enedil's user avatar
  • 155
3 votes
2 answers
10k views

What is the default value of the PATHEXT environment variable for Windows?

What is the default value for the PATHEXT environment variable for different versions of Windows? Or even better: How can you reliably determine the original default system value for PATHEXT on a ...
ebpa's user avatar
  • 245
3 votes
1 answer
3k views

batch current directory when starting as administrator

Background: I like to have my computer clean. Especially I don't like programs and services starting with my windows, but I still want to use all my programs without having to manually start ...
Zaheylu's user avatar
  • 697
3 votes
0 answers
2k views

How can I set a dynamically evaluated environment variable for Windows' Command Processor (cmd.exe)?

The Windows command processor (cmd.exe) supports environment variables like USERNAME and USEPROFILE. The value of these variable is always the same after they have been set. But if I execute echo %...
Michiel van Oosterhout's user avatar

15 30 50 per page
1
2 3 4 5