Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmd.exe installer script #154

Open
MarkTiedemann opened this issue Jun 30, 2020 · 1 comment
Open

Add cmd.exe installer script #154

MarkTiedemann opened this issue Jun 30, 2020 · 1 comment

Comments

@MarkTiedemann
Copy link
Contributor

Why?

  • Because cmd.exe is still the default Windows command prompt which, arguably, makes it more user-friendly to run the installer in cmd.exe rather than powershell.exe.
  • More choices for our users: Some people dislike cmd, some dislike powershell. By providing both, more people are gonna be happy, potentially.
  • Because we can. :)

How?

In order to do this, the .cmd installer would have to have the same capabilities as the .ps1 installer. Some of these are:

  • Download files via Invoke-WebRequest
  • Extract a .zip archive via Expand-Archive or [System.IO.Compression.ZipFile]::ExtractToDirectory
  • Add to the session's %Path% via $Env:Path and to the user's %Path% via [System.Environment]::SetEnvironmentVariable

As brought up in #153, since early 2018, curl and tar are available on Windows 10 by default. Thus, on a modern Windows 10 installation, curl could be used to download files and tar could be used to extract a .zip file.

Here's a short example:

@echo off
rem Determine latest Deno version
for /f "delims=/ tokens=6" %%v in ('"curl -s https://github.com/denoland/deno/releases | findstr \/denoland/deno/releases/download/.*/deno-x86_64-pc-windows-msvc.zip | findstr /n . | findstr ^1:"') do (
    rem Download latest Deno .zip file
    curl -Lo deno.zip https://github.com/denoland/deno/releases/download/%%v/deno-x86_64-pc-windows-msvc.zip
    rem Extract .zip file
    tar xf deno.zip
)

Manipulating the session %Path% can be done via set Path=... (or path). Manipulating the users's %Path% can be done using reg, reading and writing to the Path value of the HKEY_CURRENT_USER\Environment registry path.

Note that I'm not suggesting to drop the PowerShell installer, I'm simply suggesting that we could add an additional Command Prompt installer.

@MarkTiedemann
Copy link
Contributor Author

Here's a random experiment on how you could distribute a "one-line batch installer": https://github.com/MarkTiedemann/deno-batch-installer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant