在 dos 中,当我粘贴此命令时它会起作用:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://google.com --screenshot=c:\test\google.png --headless --hide-scrollbars --window-size=1920,1080 --disable-gpu &
当我在 Powershell 中执行相同操作时,却没有。我猜我的语法不正确?
最佳答案
您必须在 Powershell 中使用 Start-Process
并解析参数:
Start-Process -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -ArgumentList "https://google.com","--screenshot=c:\test\google.png","--headless","--hide-scrollbars","--window-size=1920,1080","--disable-gpu"
关于powershell - 可以从 cmd 调用 headless,但不能从 powershell 调用 headless,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51439219/