function Check-Failure { if ($args[0] -eq $false) { echo "" echo ("Failed to install due to an error during the " + $args[1] + " step.") echo "Please exit this script and try following the installation guide in the Crumpet user manual instead." echo "Press any key to close this window." cmd /c pause | Out-Null exit } } function Check-Installed { Get-Command $args[0] 2>&1 | Out-Null if ($? -eq $false) { echo "" echo ($args[1] + " is required, but is not installed.") echo "Please install it, then run this script again." echo "Press any key to close this window." cmd /c pause | Out-Null exit } } echo "=================" echo "Crumpet Installer" echo "=================" Check-Installed node node.js Check-Installed "C:\Program Files\7-Zip\7z" 7-Zip echo "" echo "Press any key to install Crumpet." cmd /c pause | Out-Null echo "" cd $HOME cd Downloads echo "Downloading..." (New-Object Net.WebClient).DownloadFile("https://cadence.moe/api/rtw/archive.zip", ($PWD.Path + "\crumpet.zip")) Check-Failure $? "download" cd .. echo "Extracting..." &("C:\Program Files\7-Zip\7z") x -aoa Downloads\crumpet.zip | Out-Null Check-Failure $? "extract" mv cadencegq-master crumpet rm Downloads\crumpet.zip cd crumpet echo "Installing dependencies..." npm install | Out-Null Check-Failure $? "dependencies" echo "Making shortcut..." $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Crumpet.lnk") Check-Failure $? "shortcut create" $Shortcut.TargetPath = "$Home\crumpet\start.bat" $Shortcut.WorkingDirectory = "$Home\crumpet\" $Shortcut.IconLocation = "$Home\crumpet\html\rtw-edit\crumpet-icon.ico" $Shortcut.Save() Check-Failure $? "shortcut save" explorer http://localhost:8080/crumpet node index.js