使用PowerShell创建文件夹结构

使用PowerShell创建文件夹结构,powershell,Powershell,我想使用PowerShell创建此文件夹结构: D:\feb\win10\x64\Folder1 folder2 您正在查找新项cmdlet 下面是使用newitemcmdlet创建单个文件夹的示例: New-item "D:\feb#16\LV2\7212\win10\x64\audio" -ItemType Directory -force @('audio', 'chipset', 'communication', 'docks', 'input',

我想使用PowerShell创建此文件夹结构:

D:\feb\win10\x64\Folder1
                 folder2

您正在查找
新项
cmdlet

下面是使用
newitem
cmdlet创建单个文件夹的示例:

New-item "D:\feb#16\LV2\7212\win10\x64\audio" -ItemType Directory -force
@('audio', 'chipset', 'communication', 'docks', 'input', 'network', 'security', 'storage', 'video') |
    ForEach-Object {
        New-Item (Join-Path 'D:\feb#16\LV2\7212\win10\x64\' $_) -ItemType Directory -force
    }

当然,您可以为要创建的每个子文件夹执行此操作。您还可以使用
@('folder1'、'folder2'、…)
创建子文件夹列表,并迭代这些子文件夹来创建它们。以下示例使用
连接路径
cmdlet将基本路径与当前子文件夹(当前管道对象)组合,并使用上述
新项目
cmdlet创建目录:

New-item "D:\feb#16\LV2\7212\win10\x64\audio" -ItemType Directory -force
@('audio', 'chipset', 'communication', 'docks', 'input', 'network', 'security', 'storage', 'video') |
    ForEach-Object {
        New-Item (Join-Path 'D:\feb#16\LV2\7212\win10\x64\' $_) -ItemType Directory -force
    }


我觉得这对新手来说可能太复杂了。我建议您提供一个创建单个文件夹的最基本示例,并更详细地解释您的代码!作为一个新手,这也帮助我理解你的描述。我期待你们的帮助。:)您好@MartinBrandl您能帮我分析Excel表格以给出文件夹名称吗。比如音频、芯片组……可能是的,但请重新开始question@MartinBrandl好的,我将开始一个新问题