Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run a batch file from package manager console?

I'm using code first migrations with my context class in a class library (ie not the startup project) and I want to make batch files for the common operations to save having to pass in the parameters each time I want to add-migration and update-database. I ran the "dir" command in the console and it appears to be in the solution root folder so I have tried creating a .bat,.cmd or .ps1 file in the Solution Items folder but the package manager powershell doesn't seem to be able to find it?

like image 950
wizzardmr42 Avatar asked Jun 24 '13 18:06

wizzardmr42


2 Answers

At this very moment I am happening to read this from Bruce Payette's "Powershell in Action" (Wonderful book) so share something with you, lucky guy:

"In this example (Poster: an example in the book), even though hello.ps1 is in the current directory, you had to put ./ in front of it to run it. This is because Powershell doesn't execute commands out of the current directory by default. This prevents accidental execution of the wrong command."

like image 108
Peter Avatar answered Nov 15 '22 05:11

Peter


Looks like I needed to just put a ".\" on the beginning of the batch file name - not sure if Powershell requires this to execute?

like image 41
wizzardmr42 Avatar answered Nov 15 '22 04:11

wizzardmr42