简体   繁体   中英

Installing Native Script with CmD is unresponsive - With Powershell is unrecognised Command

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"

Trying to run this script in CMD as Admin leads to no action

Running this in Powershell as admin leads to this error:

+ @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-ob ...
+             ~~~~~~~~~~
Unexpected token '-NoProfile' in expression or statement.
At line:1 char:24
+ @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-ob ...
+                        ~~~~~~~~~~~~~~~~
Unexpected token '-ExecutionPolicy' in expression or statement.
At line:1 char:1
+ @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-ob ...
+ ~~~~~~~~~~~
The splatting operator '@' cannot be used to reference variables in an expression. '@powershell' can be used only as
an argument to a command. To reference variables in an expression use '$powershell'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

I have looked at my environment variables PATH and added the path to my powershell.exe :

C:\Users\Riss\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell

But still no bueno.

The answer @lit gave is correct

Remove @ before powershell and the script powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"

will work in CMD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM