There is a working batch file with powershell code in one line:

powershell -Command "& {$cont = wget http://САЙТ.info/; $cont = $cont.Content; $FilePath = 'contentFronHtml.txt' -f $env:SystemDrive; $cont | Out-File -FilePath $FilePath -Append -Width 200;}" 

I want to break the powershell code, to get something like:

 SET LONG_COMMAND="$cont = wget http://САЙТ.info/;" "$cont = $cont.Content;" "$FilePath = 'contentFronHtml.txt' -f $env:SystemDrive;$cont | Out-File - FilePath; $FilePath -Append -Width 200;" powershell -Command "& {LONG_COMMAND}" 

How to connect strings of powershell code?

  • Why don't you do the powershell script instead of the batch file? - Pavel Mayorov

1 answer 1

got the answer in English SO

This is what I would like to do.

 PowerShell -Command "first line up to the end of a command;"^ "next line up to the end of a command;"^ "another line up to the end of a command;"^ "last line" 

You could also try this idea too:

 Set "MyCmnd=first line up to the end of a command;" Set "MyCmnd=%MyCmnd% next line up to the end of a command;" Set "MyCmnd=%MyCmnd% another line up to the end of a command;" Set "MyCmnd=%MyCmnd% last line" Echo %MyCmnd%