See my code below. The script creates the variable $backupFile. How can I use that variable in the next statement as value for the path parameter of the New-Item commend?
using (var ps = PowerShell.Create())
{
ps.RunspacePool = _runspacePool;
ps.AddScript("$backupFile = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(),'{0}.bak')".FormatInvariant(databaseName));
ps.AddStatement();
ps.AddCommand("New-Item")
.AddParameter("Force")
.AddParameter("ItemType", "File")
.AddParameter("Path", /* How to use $backupFile?? */));
ps.Invoke();
}