powershell - Windows PowerShell 在 Windows 10 上安装 NativeScript
问题描述
我尝试从 Admin PowerShell 控制台在 Windows 10 上安装 NativeScript。
https://docs.nativescript.org/start/ns-setup-win
我键入此命令并获得以下错误:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://nativescript.org/setup/win-avd'))"
解决方案
当您需要从 CMD 命令提示符运行该命令时,您正在从 PowerShell 运行该命令。
从 CMD 运行:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://nativescript.org/setup/win-avd'))"
在这里,@powershell
意思是“不要回显命令并运行 powershell.exe”。这在 PowerShell 本身中意味着完全不同的东西,这意味着“搜索路径并使用扩展@powershell
名之前的文字名称执行程序”或“将变量用作 splat 变量”,具体取决于您的 PowerShell 版本。 @powershell
$powershell
如果你在 Powershell 中运行它,你只需要运行:
iex ((new-object net.webclient).DownloadString('https://nativescript.org/setup/win-avd'))
与往常一样,在运行这些下载任意代码并立即执行的命令时要格外小心。
推荐阅读
- sql - 使用 oracle SQL 连接列
- angular - AWS ECS 替换 Dockerize Angular 应用程序中的环境变量
- android - 在 Android 10 上从 URI 获取文件路径,
- javascript - 如何将 URI 转换为 Blob,反之亦然?
- asp.net-core-2.2 - 数据级授权 (ASP.NET Core 2.2)
- python - 如何在熊猫数据框中删除字符串 NULL 值?
- hash - 在以无损格式(如 PNG、GIF 等)压缩的图像上计算散列是否安全?
- javascript - 类型'Readonly<{}> & Readonly<{ children?: ReactNode; 上不存在属性'match' }>
- reactjs - 无法对 reactjs 中未安装的组件执行 React 状态更新
- sql - combine two columns into one column rows but not same cell and categorize them