Rado
Rado

Reputation: 8963

Disable powershell expansion of command's extension?

We have a lot of existing batch files that help with the running of different perl and ruby scripts.

A batch file (e.g. test.bat) would normally be invoked like:

$ test

and within the batch file, it will set some settings and finally try to run the corresponding script file (e.g. test.pl) like this:

perl -S "%0.pl" %*

All works with cmd.exe, but today, I decided to switch to PowerShell and found out that it expands the commands. So trying to run "test" will actually run "Full\path\test.bat" and my script would complain that there is no file test.bat.pl.

Is there a way to prevent this command expansion? Rewriting all batch files is not an option.

Upvotes: 1

Views: 303

Answers (1)

manojlds
manojlds

Reputation: 301337

One way is to call cmd explicitly:

cmd /c test

Upvotes: 1

Related Questions