How do I prevent PowerShell from running a named vbs Script? For example, I have a scriptcalled 'Default.vbs', admittedly in the current $pwd directory, so that whenever I type 'default' in the PS console that script runs. Is there a way to stop this, as a simple 'typo' can act as a trigger?
PS can only launch files this simple when they are placed in one of the folders listed in $env:path. In all other places, a relative or absolute path name is required, i.e.
I see, but this runs by just typing 'default' (without the quotes). I have a bunch of VBS scripts with PS accessible names, like format, args, param (all .vbs) so these will be triggered if I do not move them. Seems very risky to me! Thanks, anyway.
If you don't need VBScript you could disable the file association. Also if you can run them by just using the script name it suggests that
has been run to make the command line the default
if you run
the defaults are reset which means you will use the graphical interface which will slow things down
best thing is to get theose scripts off the execution path
If you do not move your VBScripts, and if they have colliding names, then the same problem exists in a regular cmd session as well. I would move the VBScripts to some private folder.
The problem has been solved by removing the .VBS tag from the $env:PathExt collection.