I'm trying to run a script that while it runs it will also create a new script. The second script in the end should include those lines:
$line1 = 'some string'
$line2 = 'some string'
Start-Process $line1 -Arguments $line2
I've tried passing it from the 1st script using the code:
$lines = "$line1 = 'some string'", "$line2 = 'some string'"
foreach ($line in $lines) | Add-Content -Path script2
Which does not works since the var parts are dropped and I'm left with the '= some string' only.