Launch programs whose path contains spaces

Try:- Dim objShell Set objShell = WScript.CreateObject( “WScript.Shell” ) objShell.Run(“””c:\Program Files\Mozilla Firefox\firefox.exe”””) Set objShell = Nothing Note the extra “”s in the string. Since the path to the exe contains spaces it needs to be contained with in quotes. (In this case simply using “firefox.exe” would work). Also bear in mind that many programs exist … Read more

VBScript How can I Format Date?

0 = vbGeneralDate – Default. Returns date: mm/dd/yy and time if specified: hh:mm:ss PM/AM. 1 = vbLongDate – Returns date: weekday, monthname, year 2 = vbShortDate – Returns date: mm/dd/yy 3 = vbLongTime – Returns time: hh:mm:ss PM/AM 4 = vbShortTime – Return time: hh:mm d=CDate(“2010-02-16 13:45”) document.write(FormatDateTime(d) & “<br />”) document.write(FormatDateTime(d,1) & “<br />”) … Read more

benchmarks: does python have a faster way of walking a network folder?

The Ruby implementation for Dir is in C (the file dir.c, according to this documentation). However, the Python equivalent is implemented in Python. It’s not surprising that Python is less performant than C, but the approach used in Python gives a little more flexibility – for example, you could skip entire subtrees named e.g. ‘.svn’, … Read more

How to generate a GUID in VBScript?

Function CreateGUID Dim TypeLib Set TypeLib = CreateObject(“Scriptlet.TypeLib”) CreateGUID = Mid(TypeLib.Guid, 2, 36) End Function This function will return a plain GUID, e.g., 47BC69BD-06A5-4617-B730-B644DBCD40A9. If you want a GUID in a registry format, e.g., {47BC69BD-06A5-4617-B730-B644DBCD40A9}, change the function’s last line to CreateGUID = Left(TypeLib.Guid, 38)

Converting string to integer

The function you need is CInt. ie CInt(PrinterLabel) See Type Conversion Functions (Visual Basic) on MSDN Edit: Be aware that CInt and its relatives behave differently in VB.net and VBScript. For example, in VB.net, CInt casts to a 32-bit integer, but in VBScript, CInt casts to a 16-bit integer. Be on the lookout for potential … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)