可以从cmd调用headless,但不能从powershell调用



在dos中,当我粘贴此命令时,它可以工作:

"C:Program Files (x86)GoogleChromeApplicationchrome.exe" https://google.com --screenshot=c:testgoogle.png --headless --hide-scrollbars --window-size=1920,1080 --disable-gpu &

当我在Powershell中做同样的事情时,它不会。我想我的语法不对?

您必须在Powershell中使用Start-Process并解析Arguments:

Start-Process -FilePath "C:Program Files (x86)GoogleChromeApplicationchrome.exe" -ArgumentList "https://google.com","--screenshot=c:testgoogle.png","--headless","--hide-scrollbars","--window-size=1920,1080","--disable-gpu"

相关内容

最新更新