假设powershell位于您的PATH中,您可以这样称呼它:
"scripts": { "test": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./test.ps1"}在Windows 7和Powershell v4上进行了测试。
局限性是您需要在路径中安装Powershell。我没有在Linux上使用Powershell对其进行测试,因此不确定当前是否可以将该解决方案移植到其他平台。

假设powershell位于您的PATH中,您可以这样称呼它:
"scripts": { "test": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./test.ps1"}在Windows 7和Powershell v4上进行了测试。
局限性是您需要在路径中安装Powershell。我没有在Linux上使用Powershell对其进行测试,因此不确定当前是否可以将该解决方案移植到其他平台。