-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-public-shortcut.ps1
52 lines (42 loc) · 1.66 KB
/
create-public-shortcut.ps1
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
If ($PSVersionTable.PSVersion.Major -gt 2) {
Start-Transcript -OutputDirectory "$pwd\logs"
}
"Getting path of Anaconda3"
$CondaPath = Get-Command "conda" -ErrorAction SilentlyContinue -ErrorVariable ProcessError | Split-Path
if ($ProcessError) {
Write-Host "Anaconda installation not Found. Please install Anaconda3 and make sure it is in the system path."
Exit
}
$AnacondaPath = Split-Path $CondaPath
$IconFileExists = Test-Path ".\orange.ico"
If ($IconFileExists -eq $False) {
Write-Host "Orange icon not found. Please run the prepare.bat script."
Exit
}
$AnacondaShareDir = $AnacondaPath + "\share\orange3"
$DirExists = Test-Path $AnacondaShareDir
If ($DirExists -eq $False) {
New-Item -Path $AnacondaShareDir -ItemType "directory"
}
$AnacondaIconFilePath = $AnacondaShareDir + "\orange.ico"
$IconFilePathExists = Test-Path $AnacondaIconFilePath
If ($IconFilePathExists -eq $False) {
"Copying Orange icon to " + $AnacondaShareDir
Copy-Item .\orange.ico $AnacondaShareDir
}
$Orange3Env = & "python" get-orange-env.py
$Orange3ShortCut = "C:\Users\Public" + "\Desktop\Orange3.lnk"
$TargetPath = $AnacondaPath + "\python.exe"
$TargetArguments = $AnacondaPath + "\cwp.py " + "$Orange3Env" + " " + "$Orange3Env" + "\python.exe -m Orange.canvas"
"Creating Orange3 Shortcut"
$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut($Orange3ShortCut)
$ShortCut.TargetPath = $TargetPath;
$ShortCut.Arguments = $TargetArguments;
$ShortCut.WindowStyle = 1;
$ShortCut.IconLocation = $AnacondaShareDir + "\orange.ico";
$ShortCut.Description = "Orange3";
$ShortCut.Save()
If ($PSVersionTable.PSVersion.Major -gt 2) {
Stop-Transcript
}