CODE:
if (createpipeprocess("powershell.exe -NoLogo")))
{
_sendpipe("Set-ExecutionPolicy Unrestricted -Force");
_sendpipe("$Excel = New-Object -ComObject Excel.Application");
_sendpipe("$Excel.Visible = $True"); // если false окно не будет отображаться
_sendpipe("$WorkBook = $Excel.Workbooks.Add()");
_sendpipe("$LogiclDisk = $WorkBook.Worksheets.Item(1)");
_sendpipe("$LogiclDisk.Name = ^'Local Disk^'");
_sendpipe("$LogiclDisk.Cells.Item(1,1) = ^'Text^'");
_sendpipe("$Excel.DisplayAlerts=$False");
_sendpipe("$WorkBook.SaveAs(^'D:\MyExcel.xlsx^')");
_sendpipe("$WorkBook.Close()");
_sendpipe("$Excel.Quit()");
closepipeprocess();
}
function _sendpipe(string command)
{
string S;
sendpipe(command+"^n");
waitpipe();
getpipe(#S);
}
{
_sendpipe("Set-ExecutionPolicy Unrestricted -Force");
_sendpipe("$Excel = New-Object -ComObject Excel.Application");
_sendpipe("$Excel.Visible = $True"); // если false окно не будет отображаться
_sendpipe("$WorkBook = $Excel.Workbooks.Add()");
_sendpipe("$LogiclDisk = $WorkBook.Worksheets.Item(1)");
_sendpipe("$LogiclDisk.Name = ^'Local Disk^'");
_sendpipe("$LogiclDisk.Cells.Item(1,1) = ^'Text^'");
_sendpipe("$Excel.DisplayAlerts=$False");
_sendpipe("$WorkBook.SaveAs(^'D:\MyExcel.xlsx^')");
_sendpipe("$WorkBook.Close()");
_sendpipe("$Excel.Quit()");
closepipeprocess();
}
function _sendpipe(string command)
{
string S;
sendpipe(command+"^n");
waitpipe();
getpipe(#S);
}