Exemplo n.º 1
0
        protected override void ProcessRecord()
        {
            if (ShouldProcess(TargetPath.ProviderPath,
                              String.Format("New NTFS junction via {0}", LiteralPath.ProviderPath)))
            {
                Directory.CreateDirectory(LiteralPath.ProviderPath);

                if (!ReparsePointHelper.CreateJunction(LiteralPath.ProviderPath, TargetPath.ProviderPath))
                {
                    ErrorHandler.WriteLastWin32Error("CreateJunctionFailed", LiteralPath);
                }
                else
                {
                    WriteObject(new DirectoryInfo(LiteralPath.ProviderPath));
                }
            }
        }