anchor.diff:      SET good=true
       IF "!arg!"=="" SET good=false
       IF "!arg:~0,1!"=="-" SET good=false
  -    IF !good!==true (SHIFT) ELSE (ECHO Error: --profile requires an argument 1>&2 & EXIT /B 2)
  +    IF !good!==true (SHIFT) ELSE (ECHO Error: --profile requires an argument >> "%ERROR_FILE%" & EXIT /B 1)
       SET profile=!arg!
       SHIFT
       GOTO loop
  
positive.code: ECHO    Bucket: %bucket%
  ECHO    Key: %key%
  IF NOT "%options%"=="" ECHO    Options: %options%
  SET RESPONSE_FILE=response.txt
  SET ERROR_FILE=error.txt
  aws s3api create-multipart-upload --bucket %bucket% --key %key% %options% --profile %profile%> "%RESPONSE_FILE%" 2> "%ERROR_FILE%"
  
  :: Rethrow any error messages from the AWS API
  FOR /F %%i IN ("%ERROR_FILE%") DO SET size=%%~zi
  IF %size% GTR 0 (
      ECHO Creation failed with error message: 1>&2
      TYPE "%ERROR_FILE%" 1>&2
      DEL "%ERROR_FILE%"
      EXIT /B 1
  )
  DEL "%ERROR_FILE%"
  
  :: Store the new upload ID
  :: Remove double quotes, spaces, commas, and leading text from AWS response
  SET ID_FILE=upload-id.txt
  FINDSTR /C:"UploadId" "%RESPONSE_FILE%"> "%ID_FILE%"
  DEL "%RESPONSE_FILE%"
  SET /P uploadID= < "%ID_FILE%"
  DEL "%ID_FILE%"
  SET uploadID=%uploadID:"=%
  SET uploadID=%uploadID: =%
  SET uploadID=%uploadID:,=%
  SET uploadID=%uploadID:*:=%
  ECHO Creation succeeded with upload-id:
  ECHO    %uploadID%
  
  :: Unset local vars before exit
  SET RESPONSE_FILE=
  SET ERROR_FILE=
  SET ID_FILE=
  SET size=
  
  EXIT /B 0
  
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :: void uploadParts(string filedir)
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :uploadParts
  
  SETLOCAL EnableDelayedExpansion
  
  :: Count the number of file parts in the provided directory
  SET numFiles=0
  FOR %%F IN ("%filedir%\*.*.*") DO SET /A numFiles+=1
  
  :: Add initial lines to parts JSON file
  ECHO.
  
negative.code: :: If this arg was invalid...
  SET arg=%1
  FOR /F "usebackq tokens=*" %%a IN ('%arg%') DO SET arg=%%~a
  ECHO Error: unrecognized argument "%arg%" >> "%ERROR_FILE%"
  EXIT /B 1
  
  GOTO loop
  
  :continueParse
  
  :: If help was requested, then just exit
  IF %help%==true (EXIT /B 0)
  
  :: Ensure required arguments were provided
  SET valid=true
  IF NOT DEFINED bucket (SET valid=false & ECHO Error: You must provide a bucket name (--bucket^)! >> "%ERROR_FILE%")
  IF NOT DEFINED filedir (SET valid=false & ECHO Error: You must provide a path to a directory containing object parts! >> "%ERROR_FILE%")
  IF NOT DEFINED key (SET valid=false & ECHO Error: You must provide an object key (--key^)! >> "%ERROR_FILE%")
  
  :: Try to set the missing AWS credentials profile with an environment variable
  IF NOT DEFINED profile (
      IF DEFINED AWS_DEFAULT_PROFILE (
          SET profile=%AWS_DEFAULT_PROFILE%
      ) ELSE (
          SET valid=false
          ECHO Error: You must provide an AWS CLI credentials profile (--profile^)! >> "%ERROR_FILE%"
      )
  )
  
  IF %valid%==false EXIT /B 1
  
  :: Unset local vars before exit
  