gnucash-on-windows master: Fix bootstrap script's parameter handling when not run immediately under cscript
Geert Janssens
gjanssens at code.gnucash.org
Thu Nov 30 04:23:57 EST 2017
Updated via https://github.com/Gnucash/gnucash-on-windows/commit/4e815447 (commit)
from https://github.com/Gnucash/gnucash-on-windows/commit/69fd6b4b (commit)
commit 4e8154477c96950aa336b5e61b6c8b37bea914fa
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Nov 30 10:20:57 2017 +0100
Fix bootstrap script's parameter handling when not run immediately under cscript
diff --git a/bootstrap_win_dev.vbs b/bootstrap_win_dev.vbs
index f886072..7bd2915 100644
--- a/bootstrap_win_dev.vbs
+++ b/bootstrap_win_dev.vbs
@@ -482,20 +482,20 @@ End Function
' Make sure we run in a console (so output is visible)
-' Based on a code snipped found here
-' http://ask.metafilter.com/79481/vbscript-printing-to-command-line
+' Blatantly copied from
+' https://stackoverflow.com/questions/4692542/force-a-vbs-to-run-using-cscript-instead-of-wscript
Sub CheckStartMode
- ' Returns the running executable as upper case from the last \ symbol
- strStartExe = UCase( Mid( wscript.fullname, instrRev(wscript.fullname, "\") + 1 ) )
-
- If Not strStartExe = "CSCRIPT.EXE" Then
- ' This wasn't launched with cscript.exe, so relaunch using cscript.exe explicitly!
- ' wscript.scriptfullname is the full path to the actual script
-
- set oSh = CreateObject("wscript.shell")
- oSh.Run "cscript.exe """ & wscript.scriptfullname & """"
- wscript.quit
-
+ Dim Arg, Str
+ If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then
+ For Each Arg In WScript.Arguments
+ If InStr( Arg, " " ) Then Arg = """" & Arg & """"
+ Str = Str & " " & Arg
+ Next
+ CreateObject( "WScript.Shell" ).Run _
+ "cscript //nologo """ & _
+ WScript.ScriptFullName & _
+ """ " & Str
+ WScript.Quit
End If
End Sub
Summary of changes:
bootstrap_win_dev.vbs | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
More information about the gnucash-changes
mailing list