转换为powershell脚本

时间:2012-09-28 14:01:03

标签: powershell code-conversion

    @echo off


::
:: Grabbing the users input of job number to create
:: 
SET /P JobNum="Enter Job Number: "


::
:: Creating the job number folder structure
::
MKDIR "\\server\jobs\%JobNum%"
MKDIR "\\server\jobs\%JobNum%\DataPrep"
MKDIR "\\server\jobs\%JobNum%\DataPrep\Data"
MKDIR "\\server\jobs\%JobNum%\DataPrep\Data\Input"
MKDIR "\\server\jobs\%JobNum%\DataPrep\Data\Working"
MKDIR "\\server\jobs\%JobNum%\DataPrep\Programs"
MKDIR "\\server\jobs\%JobNum%\DataPrep\Docs"
MKDIR "\\server\jobs\%JobNum%\Prepress"
MKDIR "\\server\jobs\%JobNum%\Prepress\Working"
MKDIR "\\server\jobs\%JobNum%\Prepress\PNetImages"
MKDIR "\\server\jobs\%JobNum%\CSR"
MKDIR "\\server\jobs\%JobNum%\Production"
MKDIR "\\server\jobs\%JobNum%\Production\MailDocs"
MKDIR "\\server\jobs\%JobNum%\Production\Output"

需要将此转换为PS脚本。不确定PS命令以及它们如何从批处理文件转换。

1 个答案:

答案 0 :(得分:1)

尝试这样的事情:

$ JobNum = Read-Host -Prompt“输入工作号码:”
( “”,
“\ DataPrep”,
“\ DataPrep \数据”,
“\ DataPrep \ DATA \输入”,
“\ DataPrep \ DATA \工作”,
“\ DataPrep \程序”,
“\ DataPrep \文档”,
“\印前”,
“\印前\工作”,
“\印前\ PNetImages”,
“\ CSR”,
“\生产”,
“\生产\ MailDocs”,
“\生产\输出”)|
   foreach-object {new-item -type directory -path“\ server \ jobs \ $ JobNum $ _”}