Powershell 如何将图像粘贴到PowerPoint中

Powershell 如何将图像粘贴到PowerPoint中,powershell,powerpoint,Powershell,Powerpoint,我已将一个图像复制到剪贴板,并希望使用Microsoft powershell将此图像复制到幻灯片中 使用 下面是一个使用新空白演示文稿的示例,将剪贴板中的内容粘贴到新幻灯片: # Open PowerPoint $PowerPoint = New-Object -ComObject PowerPoint.Application # Create a new presentation $Presentation = $PowerPoint.Presentations.Add($false)

我已将一个图像复制到剪贴板,并希望使用Microsoft powershell将此图像复制到幻灯片中

使用

下面是一个使用新空白演示文稿的示例,将剪贴板中的内容粘贴到新幻灯片:

# Open PowerPoint
$PowerPoint = New-Object -ComObject PowerPoint.Application

# Create a new presentation
$Presentation = $PowerPoint.Presentations.Add($false)

# Create a new title slide
$Slide = $Presentation.Slides.Add(1,11)

# Paste contents of clipboard to slide
$Pasted = $Slide.Shapes.PasteSpecial(0,$false,$null,$null,$null,$null)
$Pasted
将包含对刚粘贴的图像的范围引用

使用

下面是一个使用新空白演示文稿的示例,将剪贴板中的内容粘贴到新幻灯片:

# Open PowerPoint
$PowerPoint = New-Object -ComObject PowerPoint.Application

# Create a new presentation
$Presentation = $PowerPoint.Presentations.Add($false)

# Create a new title slide
$Slide = $Presentation.Slides.Add(1,11)

# Paste contents of clipboard to slide
$Pasted = $Slide.Shapes.PasteSpecial(0,$false,$null,$null,$null,$null)

$Pasted
将包含对您刚刚粘贴的图像的范围引用

谢谢您的回复Mathias。您应该对他的答案发表评论,而不是您自己的问题。无论如何,如果他的答案解决了你的问题,请勾选旁边的复选标记。谢谢你的回答Mathias。你应该评论他的答案,而不是你自己的问题。不管怎样,如果他的答案解决了你的问题,请勾选旁边的复选标记。谢谢你,马蒂亚斯。这很有帮助。如果剪贴板图像来自鼠标,则它不会超过图像。当我使用CopyToClipboard从powershell调用另一个应用程序时,那里没有图像。这听起来像是一个单独的问题(可能与您使用的范围/选择表达式有关)。请随意,并记住包含一个代码示例,说明您当前如何尝试使用它谢谢您Mathias。这很有帮助。如果剪贴板图像来自鼠标,则它不会超过图像。当我使用CopyToClipboard从powershell调用另一个应用程序时,那里没有图像。这听起来像是一个单独的问题(可能与您使用的范围/选择表达式有关)。请随意使用,并记住包含您当前尝试的代码示例