C:\>sqlcmd -S(local) -U(sa) -P(password) -i F:\sql.sql
HResult 0x3, Level 16, State 1 Named Pipes Provider: Could not open a connection to SQL Server [3]. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in stance-specific error has occurred while establishing a connection to SQL Server . Server is not found or not accessible. Check if instance name is correct and i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.
How I resolve this problem
Execute this query on this folder window->system32, because every sql command executes in this folder..
C:\Windows\system32>sqlcmd -S(local) -U(sa) -P(password) -i F:\sql.sql