从Grunt执行PowerShell脚本 [英] Execute PowerShell Script from Grunt

查看:129
本文介绍了从Grunt执行PowerShell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PowerShell脚本(myScript.ps1),需要作为我的构建过程的一部分运行。我正在使用Grunt来构建我的代码。我无法弄清楚如何从Grunt运行这个脚本。有谁知道如何从Grunt运行PowerShell脚本,以便在PowerShell脚本完成之前下一个任务不会运行?

I have a PowerShell script (myScript.ps1) that I need to run as part of my build process. I'm using Grunt to build my code. I cannot figure out how to run this script from Grunt. Does anyone know how to run a PowerShell script from Grunt such that the next task won't run until the PowerShell script has completed?

谢谢!

推荐答案

您可以尝试 grunt-shell

安装

npm install --save-dev grunt-shell

加载

Load

grunt.loadNpmTasks('grunt-shell');

配置

grunt.initConfig({
    shell: {
        ps: {
            options: {
                stdout: true
            },
            command: 'powershell myScript.ps1'
        }
    }
});

使用

grunt shell:ps

这篇关于从Grunt执行PowerShell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆