Is it possible to run a VBScript in UNIX environment?

arunpandiyarajhen picture arunpandiyarajhen · Dec 2, 2013 · Viewed 34.7k times · Source

I've a Vbscript for merging excel sheet into a single workbook. I would like to know whether we could execute vbscript (.vbs) file in unix system. If yes, please help me with the procedures. Thanks in advance.

Answer

rutsky picture rutsky · Jun 5, 2014

Not sure about Unices, but on GNU/Linux it is possible to run VBScript using Wine, but VBScript support is limited.

On Debian/Ubuntu you can install as follows:

$ sudo apt-get install wine 
...
$ 

To run from command line:

$ wine cscript some-script.vbs

or

$ wine wscript some-script.vbs

For example I can run following script using Wine 1.7.19 from Ubuntu Wine PPA:

' test.vbs

'WScript.Echo "Echo test"  ' doesn't work

'MsgBox "Message box!"     ' look like doesn't work either

' Write to file - works
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("out.txt", True)
objFile.Write "Output to file test" & vbCrLf
objFile.Close

run:

$ wine cscript test.vbs
fixme:vbscript:VBScript_SetScriptState unimplemented SCRIPTSTATE_INITIALIZED
fixme:scrrun:textstream_Close (0x13e208): stub
$ cat out.txt
Output to file test
$