2

I'm using this new machine, so as usual I go and set the execution policy so that I can use my profile script, after doing that however powershell now opens all batch files in a new cmd.exe window.

I tried undoing this step but it's still the same so I think it has nothing to do with the script execution policy, also I still have the powershell window in which I originally set the execution policy and this one behaves normally, only new windows have this problem.

I may have installed some software, but nothing is related to windows, and I tried setting the PATH variable to its exact value in the working window but it does not work.

4
  • 1
    Show the code that you are using to execute a batch file. Commented May 5, 2014 at 14:10
  • 1
    Does $env:PATHEXT include '.BAT'? Commented May 5, 2014 at 14:14
  • @Rynant yes this was it, what happened is that I installed Tcl, and it added a PATHEXT variable to the user variables with the value .tcl, this new variable removed the effect of the system variable PATHEXT which now only contains, I removed PATHEXT from user variables and added .tcl to PATHEXT in the system variables and now it works, so please add the answer to get the credit Commented May 5, 2014 at 15:06
  • @MysticOdin Glad that worked; I've added my answer. Commented May 5, 2014 at 15:16

1 Answer 1

3

Batch files will open in a new window if the PATHEXT environment variable does not contain '.BAT' as one of the executable extensions.

To check the variable, enter the following at the PowerShell prompt: $env:PATHEXT

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.