1

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.

1 Answer 1

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

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.