I have SQL Server 2019 Standard installed on my Server 2019. I also have installed the SQL CMD Line tools V21.1.18246. When I open my PowerShell in Administrator mode and do a sqlcmd -? the command completes without a error but doesn't show anything. I have reinstalled the CMD LINE Tools and repaired the SQL Server install and I still can't get anything from sqlcmd. I have nothing in my logs saying there is a failure.

Access to the module location is specified in the Environment Variables on the server. I have also installed Microsoft Command Line Utilities 15 for SQL Server for the server. Also I have run the Get-Module -ListAvailable -Name sqlserver command and it shows the SQL CMD Line tools module installed in 4 locations. All of those locations are in the environments variables.

So why does sqlcmd -? return nothing?

  • From cmd, what does where sqlcmd return? It should just be an executable under your SQL Server client installation. You don't need any additional modules to run this, although installing those modules could be giving you access to additional powershell cmdlets Aug 30, 2021 at 17:57
  • @AndrewSayer when I do that command nothing happens. it just goes back to c:\windows\system32
    – JukEboX
    Sep 9, 2021 at 13:09
  • what does where where return? It should typically show C:\Windows\System32\where.exe
    – Hannah Vernon
    Sep 9, 2021 at 14:36
  • @HannahVernon again returns C:\Windows\System\where.exe
    – JukEboX
    Sep 9, 2021 at 15:20
  • But where sqlcmd returns nothing? Very strange.
    – Hannah Vernon
    Sep 9, 2021 at 15:38

1 Answer 1


sqlcmd -? via PowerShell should return version information and usage guidelines, as in:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\xxx> sqlcmd -?
Microsoft (R) SQL Server Command Line Tool
Version 15.0.4123.1 NT
Copyright (C) 2019 Microsoft Corporation. All rights reserved.

usage: Sqlcmd            [-U login id]          [-P password]
  [-S server]            [-H hostname]          [-E trusted connection]
  [-N Encrypt Connection][-C Trust Server Certificate]
  [-d use database name] [-l login timeout]     [-t query timeout]
  [-h headers]           [-s colseparator]      [-w screen width]
  [-a packetsize]        [-e echo input]        [-I Enable Quoted Identifiers]
  [-c cmdend]            [-L[c] list servers[clean output]]
  [-q "cmdline query"]   [-Q "cmdline query" and exit]
  [-m errorlevel]        [-V severitylevel]     [-W remove trailing spaces]
  [-u unicode output]    [-r[0|1] msgs to stderr]
  [-i inputfile]         [-o outputfile]        [-z new password]
  [-f  | i:[,o:]] [-Z new password and exit]
  [-k[1|2] remove[replace] control characters]
  [-y variable length type display width]
  [-Y fixed length type display width]
  [-p[1] print statistics[colon format]]
  [-R use client regional setting]
  [-K application intent]
  [-M multisubnet failover]
  [-b On error batch abort]
  [-v var = "value"...]  [-A dedicated admin connection]
  [-X[1] disable commands, startup script, environment variables [and exit]]
  [-x disable variable substitution]
  [-j Print raw error messages]
  [-g enable column encryption]
  [-G use Azure Active Directory for authentication]
  [-? show syntax summary]
PS C:\Users\xxx>

I have confirmed this using PowerShell on Windows Server 2019. I would suggest trying sqlcmd.exe -? via the regular command-line, cmd.exe.

  • Just tried that and again. I get nothing. No error just goes back to C:\Windows\System32
    – JukEboX
    Aug 30, 2021 at 17:19
  • Hannah Vernon funny part is it doesn't say that sqlcmd it not a valid cmdlet.
    – JukEboX
    Sep 2, 2021 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.