0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

bat: ファイルを別名で新規 or 上書きコピーする場合の xcopy/copy

Posted at

背景

ビルド前イベントにて条件次第でコピー元を切り替えつつ xcopy を使ってコピーしてたが、
コピー先が Git 管理してなかった為にコピー先がなく(新規)、File or Directory?の質問が出るためエラーになった。

Does specify a file name or directory name on the target(F = file, D = directory)?

で、そのための回避策

と考えてたんだけど・・結論みると激しくおバカな記録

結論

昔からの copy コマンドでよかった・・

copy
copy /y test.txt hoge\test_2.txt

試行記録

  1. 'echo F |' を先頭につけることで、(F)ile 選択をさせる・・。いやすぎる・・
    1. SendKey 的に echo を使えたんだっけ?ってレベルに bat の記憶がない・・
xcopy
echo F | xcopy /y test.txt hoge\test_2.txt
  1. オプション探索:/i
    image.png
  • ディレクトリ判定ならいける。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?