Search code examples
powershellmicrosoft-bitspowershell-5.0

Start-BitsTransfer's Destination field is not mandatory


I had a bug in a script where I'd specified -Description $dest instead of -Destination $dest on a call to Start-BitsTransfer. It didn't error / ran quickly for a small file and took a while for a large one. As such I think the file was copied to my machine; I just can't find where it was copied to...

Question

  • Why isn't Destination a mandatory field?
  • Where do files go by default / when Destination isn't specified?

Solution

  • The snarky answer to the first part of your question would probably be "because Microsoft said so". Since I wasn't involved in the decision making I can't give you a definitive answer, but example 7 of the cmdlet documentation mentions that

    The destination path cannot use wildcard characters. The destination path supports only a relative directory, a rooted path, or an implicit directory (the current directory).

    So I would suspect that the parameter was made optional to allow transferring files "here" (to the current working directory) without having to explicitly specify a destination, i.e. for simplicity of use.