-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-nodejs-win10.ps1
50 lines (38 loc) · 1.09 KB
/
install-nodejs-win10.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
#
## win10-installer.ps1
#
function downloadNodejs {
# Download the Nodjs installer
write-host "Downloading NodeJS ..."
$url = "https://nodejs.org/dist/v12.13.1/node-v12.13.1-x64.msi"
$outputFile = Split-Path $url -leaf
$output = "C:\Users\$env:UserName\Downloads\$outputFile"
Invoke-WebRequest -Uri $url -OutFile $output
## Install via a web browser
# start "https://www.mozilla.org/en-US/firefox/download/thanks/"
}
function installNodejs {
$url = "https://nodejs.org/dist/v12.13.1/node-v12.13.1-x64.msi"
$outputFile = Split-Path $url -leaf
$output = "C:\Users\$env:UserName\Downloads\$outputFile"
## if file exists, then do the do
if ( Test-Path -Path $output -PathType Leaf ) {
write-host "installing $output ..."
Start-Process -FilePath $output
} else {
downloadNodejs
Start-Process -FilePath $output
}
}
function donePrompt {
# A display prompt to indicate that the end of the script sequence is reached.
write-host ""
write-host "Done."
write-host "Press any key to continue..."
[void][System.Console]::ReadKey($true)
}
function main {
installNodejs
donePrompt
}
main