By 8 Gennaio 2019 0 Comments

PowerShell – come Salvare un file di TESTO

La sintassi “Out-File” può essere utilizzata per salvare un file (anche di testo) con Powershell.
il comando di salvataggio è : Out-File -FilePath $FilePath
quindi per riportare un esempio:

$FilePath = ‘c:\script\BackupREDMINE.txt’ -f $env:SystemDrive;
Out-File -FilePath $FilePath 

se vogliamo salvare dei dati nel file (contenuto) possiamo inizializzare delle varibiali in questo modo :

$FilePath = ‘c:\script\BackupREDMINE.txt’ -f $env:SystemDrive;
$Computer = ‘pc1’;
$Speed = 9001;
$RegCheck = $true;
$Computer,$Speed,$RegCheck -join ‘,’ | Out-File -FilePath $FilePath -Append -Width 200;

il parametro “-Append” aggiunge righe successive al file.

salvare file powershell, powershell, powershell file, save file powershell, Output PowerShell variables to a text file, powershell save text to file, powershell save output to file, powershell save file, file powershell, file powershell save

Posted in: Powershell

About the Author:

shared on wplocker.com