トリックである:(とにかく動作しないでしょう)md %time%
のようなものを使ってフォルダを作成しますが、変数を作成し、md
とcopy
のためにそれを使用しないでください。代わりに新しいを作成する
@echo off
REM change to the destination folder:
cd /D c:\destination
REM generate datetime-string:
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
REM format to the desired format (example):
set string=%datetime:~0,12%
REM create a subfolder:
md %string%
REM xopy the file:
copy "c:\test\myfile.txt" "c:\destination\%string%\"
はmd
コマンドを忘れてcopy
行を置き換えます:
copy "c:\test\myfile.txt" "c:\destination\%string%-myfile.txt"
内側に単一のファイルとフォルダを、私はちょうど日付時刻文字列が含まれるようにテキストファイルの名前を変更します
定期的に実行するには、スケジュールされたタスクを使用することをお勧めします。
[MD](http://ss64.com/nt/md.html)[TIME](http://ss64.com/nt/time.html)を含むバッチファイルを作成し、スケジュール設定します仕事。 – Tim
[this](http://stackoverflow.com/a/18024049/2152082)がお手伝いできるかどうかをご確認ください。 – Stephan
OK。しかし、c:\ test \のtxtファイルを新しい生成されたフォルダにコピーする方法。あなたは私にコマンド –