The -InputFile parameter information in the Invoke-Sqlcmd documentation states "Spaces are not allowed in the file path or file name". However, Invoke-SqlCmd executes successfully when the -InputFile parameter is used with a path and a file name that both contain spaces (e.g.: Invoke-SqlCmd -InputFile 'C:\[path containing spaces]\New Text Document.sql' [...]), at least in the following environment.
Client:
SqlServer PowerShell module version: 22.1.1
PSVersion: 7.4.0
OS: Microsoft Windows 10.0.19045 (Windows 10)
Server:
Product: Azure SQL Database Managed Instance
Operating System: Windows Server 2019 Datacenter (10.0)
The
-InputFile
parameter information in theInvoke-Sqlcmd
documentation states "Spaces are not allowed in the file path or file name". However,Invoke-SqlCmd
executes successfully when the-InputFile
parameter is used with a path and a file name that both contain spaces (e.g.:Invoke-SqlCmd -InputFile 'C:\[path containing spaces]\New Text Document.sql' [...]
), at least in the following environment.Client:
Server: