- @echo off
- set "url=http://www.baidu.com/"
- for /f "delims=" %%A in ('powershell -c "try{$webclient=New-Object System.Net.WebClient;$stream=$webclient.OpenRead($env:url);$webclient.ResponseHeaders['Set-Cookie'];}catch{}finally{if($stream){$stream.Close()}if($webclient){$webclient.Dispose()}}"') do (
- set cookies=%%A
- )
- echo cookies="%cookies%"
- pause
复制代码
|