I struggled with all these answers and I think it may be confusing to someone who is new to composer on Windows 10
This gives you better understanding of paths and Windows Environment Variables settings. However, it also includes installing php7 and integration with cakephp which you might want to skip and focus on (Composer and phpcs)
I found the fix at https://www.bravo-kernel.com/2017/03/installing-php7-composer-and-codesniffer-on-windows10-for-vscode/
And it had everything I needed to get phpcs working perfectly.
PROCEEDURE:
Download Composer for Windows 10 Here
Install Composer on Windows 10
Open Command Prompt(cmd.exe) and type "composer" and hit the enter key (Just search the windows start for "cmd")
Microsoft Windows [Version 10.0.19042.1165]
(c) Microsoft Corporation. All rights reserved.
C:\Users\systemuser>composer
If composer is properly installed you will get a response with something like this
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 2.1.5 2021-07-23 10:35:47
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as
working directory.
--no-cache Prevent use of the cache
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for
normal output, 2 for more verbose output and 3 for debug
Available commands:
(It continues)
If you do not intend to change the default directory you can now install phpcs otherwise you can use instructions from the link above to set a new executable path. The default composer directory is
C:/Users/systemuser/AppData/Roaming/Composer
Now in Command prompt add the following command (Global installation):
composer global require squizlabs/php_codesniffer
Here is what it will look like:
C:\Users\systemuser>composer global require squizlabs/php_codesniffer
Changed current directory to C:/Users/systemuser/AppData/Roaming/Composer
Using version ^3.6 for squizlabs/php_codesniffer
./composer.json has been updated
Running composer update squizlabs/php_codesniffer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
C:\Users\systemuser>
Note: Nothing installed because I already installed phpcs. Also you can see that composer switched to the default directory, if this doesn't happen you need to navigate to the appropriate directory with "cd newpath" before installing phpcs:
C:\Users\systemuser>cd AppData\Roaming\Composer
The result is:
C:\Users\systemuser\AppData\Roaming\Composer>
You have completed the installation so verify the app path by navigating the path

Now you can copy the link to the phpcs file and paste in VSCode (If you changed your composer bin path then you need to copy the appropriate directory). It should look like this
C:\Users\sytemuser\AppData\Roaming\Composer\vendor\bin\phpcs

Now phpcs should work fine after installing the extension!