Closed datadill closed 2 years ago
I think this has something to do with how powershell treats brackets in Get-Item. If you try escaping []
symbols with a backtick (`) I think that would fix it for you. The solution here would be to add -LiteralPath parameter to the functions, which shouldn't be too hard.
I pondered about whether I can add -LiteralPath parameter, and seems like I wouldn't be able to. Functions use different parameter names, and adding a -Literal* counterpart to each of them seems excessive. However, Get-DbopsFile accepts results from Get-Item
/Get-ChildItem
, which means you can do something like this:
Install-DBOScript -Path (Get-Item -LiteralPath '.\CREATE PROCEDURE [dbo].[myProc].sql') ...
This would pass a FileSystemInfo
object to the command and it would be able to handle it nicely. The alternative, like I mentioned before, should be escaping the symbols.
I have a path that looks like the following:
.\CREATE PROCEDURE [dbo].[myProc].sql
No matter what I tried, Install-DBOScript fails because the path is not valid. This is because the brackets are not accepted and thus no amount of escaping will allow me to get past the function Get-DbopsFile. I have altered this internal function myself to specify -LiteralPath instead of the default -Path. I am not sure what issues this could cause, but it seems like a straightforward change. Happy to test further if needed.
Thanks!