In the previous post, I showed you how to use Visual Studio to compare 2 files. I also use Visual Studio Code from time to time. And, as every great IDE, Visual Studio Code also have a great diff tool.
As with Visual Studio, you can use it to compare 2 versions of the same file if you use a source control. But you can also compare 2 files from your file system.
Comparing files using the User Interface
Open the 2 files in Visual Studio Code
Right click on one file and click "Select for compare"
Right click on the other file and click "Compare file file1 with file2"
You should see the result:
Comparing files using the command line
Using Visual Studio Code
"%ProgramFiles%\Microsoft VS Code\bin\code" --diff file1.cs file2.cs
Using Visual Studio Code Insiders
"%ProgramFiles%\Microsoft VS Code Insiders\bin\code-insiders" --diff file1.cs file2.cs
The diff tool of Visual Studio is very good to compare 2 files. You can use it to compare two versions of the same file directly in Visual Studio. But you can also use it to compare 2 files that are not in a solution.
Using the command line
Open the developer command prompt from the start menu, so devenv.exe is already in the path
Use the following command line:
devenv /diff file1.cs file2.cs
Using the Command Window in Visual Studio
If you have already opened Visual Studio, you can use the Command Window to diff files.
Open the Command Window using the Quick Launch or using the keyboard Ctrl+W, A
Using the command Tools.DiffFiles with the 2 files to compare:
Tools.DiffFiles "file1.cs" "file2.cs"
You'll get the same result as with the command line:
As a developper or an administrator, you often use the Windows Console. Before Windows 10 and Windows Server 2016,
it was a pain. The main burden was the 80 columns limitation. But Microsoft has finally decided to make some
improvements. The major improvement is the console now support more than 80 columns and common shortcuts such as
Ctrl+C and Ctrl+V. Here's are some tips to help you using the console.
Quickly open a cmd from the explorer
You often want to open a console in a specific directory. Instead of using the cd command, you can open it from the explorer. Simply enter cmd in the search bar and press enter. You can focus the search bar by pressing CTRL+L.
Of course, you can replace cmd by powershell 😉
Change the transparency (Ctrl+Shift+Mouse wheel)
You can change the transparency of the console using Ctrl+Shift+Mouse wheel or
Ctrl+Shift++ and Ctrl+Shift+-. This allows to view the window behind.
Full Screen (F11)
If you are only using the console, such as on Windows Server Core, you can show the console
in full screen using F11 or Alt+Enter. This will make your Windows looks like Linux 😃
Commands history (F7)
It's nice to avoid typing a command twice. The console keeps an history of all the executed commands, so you
can reuse them latter. Navigating using up and down is not so useful as you don't always know which is
the previous command. The console has an awesome ui for showing previous commands 😃
You can show it using F7
Find text (Ctrl+F)
Sometimes you need to search in the output of a command. Of course you can read the whole output and
find what you are looking for. But, if the output is very long, you'll spend long minutes. As in many
applications, you can find text using Ctrl+F