在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"