8

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!

user2871401
  • 1,867
  • 5
  • 22
  • 24

1 Answers1

9

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
bevacqua
  • 47,502
  • 56
  • 171
  • 285
  • In my case "ps" is a Powershell Cmdlet for Get-Process command. Invoking the script with "powershell" command did the job. – ljubomir Dec 06 '13 at 15:36