forked from XX-net/XX-Net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.vbs
64 lines (48 loc) · 1.66 KB
/
start.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Function CurrentPath()
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
CurrentPath = objFSO.GetParentFolderName(objFile)
End Function
Function CurrentVersion()
strCurrentPath = CurrentPath()
strVersionFile = strCurrentPath & "/code/version.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(strVersionFile)) Then
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile(strVersionFile,1)
CurrentVersion = objFileToRead.ReadLine()
version_path = strCurrentPath & "/code/" & CurrentVersion & "/launcher/start.py"
If( Not fso.FileExists(version_path) ) Then
CurrentVersion = "default"
End If
objFileToRead.Close
Set objFileToRead = Nothing
Else
CurrentVersion = "default"
End If
End Function
Function isConsole()
Set objArgs = Wscript.Arguments
'WScript.Echo objArgs.Count
'WScript.Echo objArgs(0)
isConsole = 0
If objArgs.Count > 0 Then
if objArgs(0) = "console" Then
isConsole = 1
End If
End If
End Function
strCurrentPath = CurrentPath()
strVersion = CurrentVersion()
Dim strArgs
quo = """"
If isConsole() Then
python_cmd = "python.exe"
Else
python_cmd = "pythonw.exe"
End If
strExecutable = quo & strCurrentPath & "\code\" & strVersion & "\python27\1.0\" & python_cmd & quo
strArgs = strExecutable & " " & quo & strCurrentPath & "\code\" & strVersion & "\launcher\start.py" & quo
'WScript.Echo strArgs
Set oShell = CreateObject ("Wscript.Shell")
oShell.Run strArgs, isConsole(), false