Why isn't Drush recognized as command? I ran composer global require drush/drush:8.1.3 and added C:/Users/username/AppData/Roaming/Composer/vendor/drush/drush to the value of the PATH variable.

drush status returns the following output.

 PHP configuration      :  C:\xampp\php\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:\Users\username\AppData\Roaming\Composer\vendor\dr
                           ush\drush\drush
 Drush version          :  8.1.3
 Drush temp directory   :  C:\Users\username\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :


When I change directory to the one containing the Drupal files, and I run drush status, I get this error.


  'C:\xampp\htdocs\drupal-project\drush' is not recognized as an internal or external command,operable program or batch file.


Why?
There are many things to comment here: Why are you installing Drush 8 and why the specific (outdated) version 8.1.3? 

What happens is that your global Drush looks for a site local Drush, finds something ("C:\xampp\htdocs\drupal-project\drush") and tries to execute it.

The recommended approach - at least if you have a site local Drush, which you have if you installed Drupal using Composer and "drupal-composer/drupal-project" - is to use Drush Launcher (instead of a global Drush). NB! Read this issue so it works smoothly on Windows.

After you have fixed the path so Drush Launcher is used instead of the global Drush, try drush status again. I expect it to find the correct site local Drush. You migh also want to try drush --versionto verify which version of the launcher and Drush itself that is used.

You can test that the setup is correct by running Drush inside the directory containing Drupal:

1) If you have installed Drush Launcher correct, you should get the following output:

# drush --version
Drush Launcher Version: 0.6.0
Drush Commandline Tool 9.2.3


2) If you however have installed a global Drush 9 (using Compser) in stead of Drush Launcher, you get the following output:

# drush --version
'PATH_TO_DRUPAL_PROJECT/vendor/drush/drush/drush' is not recognized as an internal 
or external command, operable program or batch file.