-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.vbs
92 lines (69 loc) · 3 KB
/
configure.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
'-----------------------------------------------------------------------
' Singularity RDK configuration tool
' (c) 2008 - Microsoft Corporation
'-----------------------------------------------------------------------
'-----------------------------------------------------------------------
' Splash
WScript.Echo "------------------------------------------------------------------"
WScript.Echo "- -"
WScript.Echo "- S I N G U L A R I T Y -"
WScript.Echo "- -"
WScript.Echo "- RDK 2.0 -"
WScript.Echo "- -"
WScript.Echo "------------------------------------------------------------------"
WScript.Echo
WScript.Echo
WScript.Echo "This script will configure Singularity RDK build to the"
WScript.Echo "following location:"
WScript.Echo
'-----------------------------------------------------------------------
' Objects
set WshShell = WScript.CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application")
'-----------------------------------------------------------------------
' Running from this location
If WScript.Arguments.Count = 1 Then
runningFrom = WScript.Arguments(0)
Else
runningFrom = WshShell.CurrentDirectory
End If
WScript.Echo chr(9) & runningFrom
'-----------------------------------------------------------------------
' Wait for input
WScript.Echo
WScript.Echo "Press ENTER to start..."
WScript.StdIn.Read(1)
'-----------------------------------------------------------------------
WScript.Echo
WScript.Echo
'-----------------------------------------------------------------------
' Determine desktop location
Set objFolder = objShell.Namespace(&H0)
Set objFolderItem = objFolder.Self
desktop = objFolderItem.Path
CreateIcon desktop
Set objFolder = objShell.Namespace(&H17)
Set objFolderItem = objFolder.Self
programs = objFolderItem.Path
CreateIcon programs
Sub CreateIcon(base)
On Error Resume Next
'-----------------------------------------------------------------------
' Add build icon to desktop
set oShellLink = WshShell.CreateShortcut(base & "\Singularity RDK 2.0.lnk")
'Define where you would like the shortcut to point to. This can be a program, Web site, etc.
oShellLink.TargetPath = "%windir%\system32\cmd.exe"
oShellLink.Arguments = "/k " & Chr(34) & "base\setenv.cmd" & Chr(34)
oShellLink.WindowStyle = 1
'Define what icon the shortcut should use. Here we use the explorer.exe icon.
oShellLink.IconLocation = runningFrom & "\singularity.ico"
oShellLink.Description = "Singularity environment build window"
oShellLink.WorkingDirectory = runningFrom
oShellLink.Save
If Err <> 0 Then
WScript.Echo
WScript.Echo "*** ERROR: A problem occurred while creating the shortcut."
WScript.Echo chr(9) & "Please make sure you ran this program with administrator privileges."
WScript.Echo
End If
End Sub