In powershell through sqlServer:\sql\servername\default\databases\databasename\storedprocedures> I am able to create a text or .sql file with all of the stored procs in the directory into one text file. I am wondering how I can script each stored proc into it's own .sql or txt file.
Here is what I have so far:
foreach($Name in dir) {GCI | % {$_.script()} | out-file C:\?.txt}
I have tried 'c:\'+$Name+'.txt', ('c:\'+$Name+'.txt'), 'c:\'+$_.Name+'.txt' , etc. I'm pretty new to powershell and I'm not sure what to do and I can't find out anything on-line that writes to a file without a specific name.
Any help would be appreciated.
Thanks
Here is what I have so far:
foreach($Name in dir) {GCI | % {$_.script()} | out-file C:\?.txt}
I have tried 'c:\'+$Name+'.txt', ('c:\'+$Name+'.txt'), 'c:\'+$_.Name+'.txt' , etc. I'm pretty new to powershell and I'm not sure what to do and I can't find out anything on-line that writes to a file without a specific name.
Any help would be appreciated.
Thanks