Say I have a file on my desktop that doesn't have extension, but contains some code (say Batch or VBS).
Can I run this code without adding an extension to the file?
I was personally thinking about using powershell to pass an extension to wscript.exe, but this turned out to be somewhat impossible.
Asked
Active
Viewed 1,447 times
1

inecrafter
- 57
- 7
1 Answers
1
For VBS\JS scripts you need to specify engine with //E
switch.
Examples:
- If file
xxx
contains VbScript code:wscript //E:VBScript c:\xxx
- If file
xxx
contains JavaScript code:wscript //E:JScript c:\xxx
For batch files, it's not so easy. There is some workarounds, but they're somewhat limited: How to run batch script with out using *.bat extension

Community
- 1
- 1

beatcracker
- 6,714
- 1
- 18
- 41