Execute PowerShell Script from Grunt

亡梦爱人 提交于 2019-12-21 00:24:12

问题


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?

Thank you!


回答1:


You could give a try to grunt-shell

Install

npm install --save-dev grunt-shell

Load

grunt.loadNpmTasks('grunt-shell');

Configure

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

Use

grunt shell:ps


来源:https://stackoverflow.com/questions/20077763/execute-powershell-script-from-grunt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!