私は暗闇の中でちょっと迷っています。バッチファイルは、意図したファイルの削除不可能な双子を無作為に作成します。
私たちの部門では、新しいプロジェクト管理プロセスを実装する必要がありました。そこで、バッチファイルを作成してプロジェクトの名前を尋ね、テンプレートファイル構造をコピーし、指定された名前にさまざまなファイル名を変更してから、ワードドキュメントを開きます。最初のキャッチは、このすべてがネットワークドライブ上で行われなければならないということでした。理論的にはかなり単純なものですが、私の同僚の一人にとっては時折、かなり刺激的なことがあります。ファイル構造のコピーを1つ作成するのではなく、ファイル構造を2つ作成します。作成するこの2番目のファイルはアクセスできず、削除もできません。自分のラップトップでエラーを再現することはできず、およそ3回に1回発生します。私はなぜこの2番目のファイルを作成するのか、または一度作成したときにはそれが不可能であった理由を理解できません。誰でも光を当てることはできますか?ここで
は、私が使用しているファイルのコードです:
@echo off
pushd $networkdrive\folder\Projects
SET initDir=$networkdrive\folder\Projects
SET newDir=
SET /p ver=<"$networkdrive\folder\projectnum.txt"
SET /P newDir=Please enter the title of the new project: %=%
IF DEFINED newDir (
MD "$networkdrive\folder\Projects\%ver%. %newDir%\"
SET initDir="%initDir%\%ver%. %newDir%\"
)
xcopy "$networkdrive\folder\Creative Briefing Template" %initDir% /s/e
ren %initDir%"1. Campaign Initiation"\"Campaign Initiation Document.docx" "%newDir% Initiation Document.docx"
ren %initDir%"2. Campaign Development"\"Project Finances.xlsx" "%newDir% Project Finances.xlsx"
ren %initDir%"2. Campaign Development"\"1. Briefing"\"Creative Briefing Document.docx" "%newDir% Creative Briefing Document.docx"
ren %initDir%"2. Campaign Development"\"1. Briefing"\"Integrated CRM brief.xlsx" "%newDir% CRM Brief.xlsx"
ren %initDIR%"3. Final Assets and Sign Off Document"\"Sign off sheet.docx" "%newDir% Sign off sheet.docx"
SET /a newVer=%ver%+1
echo %newVer% > "$networkdrive\folder\projectnum.txt"
%initDir%"1. Campaign Initiation"\"%newDir% Initiation Document.docx"
popd
cls
'$ networkdrive'とは何ですか? – Compo
ファイルはホストされ、ネットワークドライブ上で実行されます。私は完全なファイル名を与えたくないので、$ networkdrive/folder/ –
と置き換えました_ "この2つ目は作成できません。また、削除不能です" _どのフォルダやファイル名にアクセスできないと削除できないのですか? – aphoria