0

I know how to run a vbscript file which has its file extension i.e. vbscript.vbs but how do you run a vbscript file without the file extension. I'm trying the following:

Process process = new Process();
process.StartInfo.FileName = @"vbscript"; //No extension
process.StartInfo.UseShellExecute  = false;
process.Start();
4

2 Answers 2

1

When you directly call a .vbs file, the system checks the registry to see what executable should handle the task. Instead of leaving it to the system, invoke the scripting host with the adecuated information

cscript.exe //e:vbscript noExtensionFile

or

wscript.exe //e:vbscript noExtensionFile

The //e: switch allows you to indicate the scripting engine that will be used to process the noExtensionFile file

Sign up to request clarification or add additional context in comments.

Comments

1

You can use the MSScriptControl to execute VBSCript code. So you could read in your file and then execute the code with the MSScriptControl.

Here you can find an example and change it so it fit your needs: C# run VBScript with MSScriptControl AddObject with string failed

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.