'How to copy a directory into another directory, where destination uses an asterisk to complete its name?

The following command works:

cd *foo

And the directory is changed to 1234foo. The numbers before foo can variate, and the foo part will be always the same. However, when I'm trying to copy bar into *foo, it won't work.

C:\>copy bar *foo\
bar\*
The system cannot find the file specified.
       0 file(s) copied.

I'm aware that this might be a duplicate question.



Solution 1:[1]

pushd "*foo"
copy bar .
popd

Naturally, you'll have to adjust bar to suit. ..\bar would seem appropriate.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Magoo