我为客户创建了一个批处理文件来创建项目目录
在为 wexample“A001 测试项目”创建根文件夹时,我必须添加引号,然后根据需要创建所有目录。
当涉及到 ICACLS 时,它会失败,因为它不需要 %dname% 周围的 ""
我怎样才能删除这部分的报价,以便 ICACLS 可以工作。
批处理文件代码如下;
color 9f
@ECHO OFF
CLS
ECHO Directory Creator Tool
ECHO.
ECHO Any errors please report to Me
ECHO.
ECHO Type below the name of the new project
ECHO.
ECHO.
ECHO PLEASE REMEMBER TO ADD COMMAS "BEFORE AND AFTER THE PROJECT NAME"
ECHO.
ECHO.
ECHO Example... Enter Project Name? "A001, Test Project"
ECHO.
ECHO.
ECHO.
set /p dname= Enter Project Name?
mkdir P:\%dname%
mkdir P:\%dname%\Communications
mkdir P:\%dname%\Communications\"Base Information"
mkdir P:\%dname%\Communications\"Base Information"\Authorities
mkdir P:\%dname%\Communications\"Base Information"\Authorities\Superseded
mkdir P:\%dname%\Communications\"Base Information"\Drainage
mkdir P:\%dname%\Communications\"Base Information"\Drainage\Superseded
mkdir P:\%dname%\Communications\"Base Information"\Layout-Masterplan
mkdir P:\%dname%\Communications\"Base Information"\Layout-Masterplan\Superseded
mkdir P:\%dname%\Communications\"Base Information"\"OS Data"
mkdir P:\%dname%\Communications\"Base Information"\"OS Data"\Superseded
mkdir P:\%dname%\Communications\"Base Information"\Planning
mkdir P:\%dname%\Communications\"Base Information"\Planning\Superseded
mkdir P:\%dname%\Communications\"Base Information"\"Topo Survey"
mkdir P:\%dname%\Communications\"Base Information"\"Topo Survey"\Superseded
mkdir P:\%dname%\Communications\"Base Information"\Utilities
mkdir P:\%dname%\Communications\"Base Information"\Utilities\Superseded
mkdir P:\%dname%\Communications\"Base Information"\"Working Dwgs"
mkdir P:\%dname%\Communications\"Base Information"\"Working Dwgs"\SuperSeded
mkdir P:\%dname%\Communications\Correspondance
mkdir P:\%dname%\Communications\Correspondance\"Emailed Sketches"
mkdir P:\%dname%\Deliverables
mkdir P:\%dname%\Deliverables\Drawings
mkdir P:\%dname%\Deliverables\Drawings\"Base Xrefs"
mkdir P:\%dname%\Deliverables\Drawings\"Base Xrefs"\Superseded
mkdir P:\%dname%\Deliverables\Drawings\"Digital Copies"
mkdir P:\%dname%\Deliverables\Drawings\"Digital Copies"\Superseded
mkdir P:\%dname%\Deliverables\Drawings\Superseded
mkdir P:\%dname%\Deliverables\"Micro Drainage"
mkdir P:\%dname%\Deliverables\"Micro Drainage"\Superseded
mkdir P:\%dname%\Deliverables\"Micro Drainage"\"Working Input-Output Files"
mkdir P:\%dname%\Deliverables\PDS
mkdir P:\%dname%\Deliverables\PDS\"Working Input-Output Files"
mkdir P:\%dname%\Deliverables\Reports
mkdir P:\%dname%\Deliverables\Reports\Superseded
mkdir P:\%dname%\"Project Management"
mkdir P:\%dname%\"Project Management"\"CDM,H&S"
mkdir P:\%dname%\"Project Management"\Contract
mkdir P:\%dname%\"Project Management"\Financial
mkdir P:\%dname%\"Project Management"\Programme
mkdir P:\%dname%\"Project Management"\Proposal
mkdir P:\%dname%\"Project Management"\QM
mkdir P:\%dname%\"Project Management"\Financial\"Cost Tracking"
mkdir P:\%dname%\"Project Management"\Financial\Invoices
xcopy P:\Templates\"BLANK Designers Risk Assessment DRA 01.docx" P:\%dname%\"Project Management"\"CDM,H&S"\
xcopy P:\Templates\"BLANK Designers Risk Assessment DRA 02.docx" P:\%dname%\"Project Management"\"CDM,H&S"\
xcopy P:\Templates\"BLANK Site Risk Assessment Method Statement.docx" P:\%dname%\"Project Management"\"CDM,H&S"\
xcopy P:\Templates\"QM Form 904 Project Issue Register v2.docx" P:\%dname%\"Project Management"\QM
set /p dname= Enter Project Name?
ICACLS "P:\%dname%" /inheritance:r
ICACLS "P:\%dname%" /grant:r JPITS05\Admin:(OI)(CI)(F)
ICACLS "P:\%dname%" /grant:r ALPCE:(OI)(CI)(F)
ICACLS "P:\%dname%" /grant:r ALPCEusers:(OI)(CI)(R)
icacls "P:\%dname%\Communications\Base Information" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Communications\Correspondance" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Deliverables\Drawings" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Deliverables\Micro Drainage" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Deliverables\PDS" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Deliverables\Reports" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\CDM,H&S" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\Contract" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\Financial" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\Programme" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\Proposal" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\QM" /grant:r ALPCEusers:(OI)(CI)(F)" /grant:r ALPCEusers:(OI)(CI)(F)
icacls "P:\%dname%\Project Management\Financial\Invoices" /grant:r ALPCEusers:(OI)(CI)(F)
ECHO Complete
Pause
exit