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,248 times
0
inecrafter
- 47
- 7
1 Answers
0
For VBS\JS scripts you need to specify engine with //E switch.
Examples:
- If file
xxxcontains VbScript code:wscript //E:VBScript c:\xxx - If file
xxxcontains 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,344
- 1
- 17
- 38