我有以下脚本通过nuget(从Chocolatey安装nuget)安装sql server模块
$Check = Get-Module -ListAvailable SqlServer
if ($Check -eq $null)
{
write-host "`r`nSqlServer Module Not Found - Installing..."
#Installing Chocolatey
& ".\InstallChocolatey.ps1"
#installing SqlServer Module
start powershell {
choco install nuget.commandline –pre -y
Install-Module -Name SqlServer <# –Scope AllUsers #> -Confirm:$false -AllowClobber
Read-Host
}
write-host "`r`n $Check installed!"
}
else { write-host "`r`n $Check installed!" }
当我运行脚本时
我得到这些错误:
Chocolatey v0.10.13
Installing the following packages:
nuget.commandline;â?pre -y
Install-Module -Name SqlServer <# â?Scope;AllUsers
By installing you accept licenses for the packages.
nuget.commandline v5.0.2 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
Chocolatey installed 0/0 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Illegal characters in path.
这些非法字符来自哪里?
答案 0 :(得分:1)
想通了
pre(--pre
)之前的破折号长度与常规破折号不同;
对于-Scope