Install Python with cmd or powershell

后端 未结 3 469
执笔经年
执笔经年 2021-01-18 11:52

My question is if you can install python with powershell, cmd, vbs or any other language built into Windows already? If this was already asked please redirect me to the answ

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-18 12:44

    You can not install it without administrator privileges. It would be lack of security I guess. What you can use in pipelines for instance is:

    $url = "https://www.python.org/ftp/python/3.7.6/python-3.7.6-amd64.exe"
    $output = "C:/tmp/python-3.7.6-amd64.exe"
    
    if (Test-Path $output) {
        Write-Host "Script exists - skipping installation"
        return;
    }
    
    New-Item -ItemType Directory -Force -Path C:/tmp
    
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Invoke-WebRequest -Uri $url -OutFile $output
    
    
    & $output /passive InstallAllUsers=1 PrependPath=1 Include_test=0 
    

    But still, Admin rights are required

提交回复
热议问题