CommandLine Commands for SQLDBA's

Опубликовано: 20 Март 2026
на канале: NextGenSQLDBA
606
23

Reach me +91 9966246368(whatsapp)/[email protected]
Document link: https://docs.google.com/document/d/17...

1. Where

A. Using Windows Search:
• Press Win + S to open the search bar.
• Type SqlPackage.exe and press Enter to search for the file.
B. Using Command Prompt:
• Open Command Prompt.
• Run the following command to search for SqlPackage.exe
where /R C:\ sqlpackage.exe
Ex: C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019\MSSQL\Binn\SqlPackage.exe /Action:Export /SourceServerName:AR-IN-L-190\SQL2019 /SourceDatabaseName:master /TargetFile:master.bacpac

2. forfiles
forfiles /p C:\ /s /m . /c "cmd /c if @fsize gtr 104857600 echo @path @fsize" /d -0 output.txt

Here's a breakdown of the command:
• /p C:\ specifies the path to start the search (change C:\ to another drive or folder if needed).
• /s includes subdirectories in the search.
• /m . matches all files.
• /c "cmd /c if @fsize gtr 104857600 echo @path @fsize" runs the specified command on each file found. @fsize gtr 104857600 checks if the file size is greater than 100 MB.
• /d -0 ensures the command runs regardless of the file date.
This command will list the paths and sizes of all files larger than 100 MB found in the specified location and its subdirectories. If you want to redirect the output to a text file, you can append output.txt to the command: