calling ajaxmin build task from vbscript

Posted by  Manoj Bhatt
 1973  View(s)
Rate this:
Hi Expert,

I have a java script file which I wanted to have minification and compression on so I found this site . I can use the command line to perform the procedure on my java script file but I was wondering if it is possible to do that with VBScript. Has anybody used this tool before .I want this to work inside my script in which I am reading from an external file and creating a new file and wanted to compress it so was thinking if I can do this all in my script itself.In the below code I am just reading and writing to the txsOutPut file. I wanted to compress this file..I can run the command line ajaxmin test.js -o test.min.js and get the result but wanted to do this inside the script iteslf.

Set req = CreateObject("Msxml2.XMLHttp.6.0") "GET", strInputPath1, False
If req.Status = 200 Then   
  txsOutput.Writeline req.responseText

Edit: Just found out that we can call the exe's directly from the script like the question is how do I pass in parameters when running the exe

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe""")
Set objShell = Nothing

Your help is greatly appreciated.
  1. Re: calling ajaxmin build task from vbscript

    Hi Manoj,

    You can try as following 

    objShell.Run """C:\path\to\some.exe"" param1 param2 ..."