正确认识 Source 参数
Enable-WindowsOptionalFeature
Enables a feature in a Windows image.
语法
Enable-WindowsOptionalFeature [-All] [-LimitAccess] [-LogLevel <LogLevel>] [-LogPath <String>] [-NoRestart] [-PackageName <String>] [-ScratchDirectory <String>] [-Source <String[]>] [-SystemDrive <String>] [-WindowsDirectory <String>] -FeatureName <String[]> -Online [<CommonParameters>]
Enable-WindowsOptionalFeature [-All] [-LimitAccess] [-LogLevel <LogLevel>] [-LogPath <String>] [-NoRestart] [-PackageName <String>] [-ScratchDirectory <String>] [-Source <String[]>] [-SystemDrive <String>] [-WindowsDirectory <String>] -FeatureName <String[]> -Path <String> [<CommonParameters>]
…
…
-Source <String[]>
Specifies the location of the files that are required to restore a feature that has been removed from the image. You can specify the Windows directory of a mounted image or a running Windows installation that is shared on the network.
If you specify multiple Source arguments, the files are gathered from the first location where they are found and the rest of the locations are ignored. Separate feature names with a comma.
一直错误地认为 Source 只支持一个目录,还纳闷一个目录为啥要用数组呢?
原来是支持多个目录的;
如果在多个目录下有同名的文件,只使用第一个目录中的,其余的忽略。
而不是只认第一个目录,其余的忽略。
唉!
多个目录用逗号分隔。