SBM ModScript Reference → Programming SBM ModScript → Object Types → TempFile → TempFile GetFileName() Method
Gets the full file name with path.
Parameter | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
string |
The full file path. |
SBM ModScript version: 11.4.
var f = TempFile(); Ext.WriteTextFile( f.GetFileName(), "Information\n" ); Ext.AppendTextFile( f.GetFileName(), "More Info\n" ); Ext.WriteStream( Ext.ReadTextFile( f.GetFileName() ) );
Example with PowerShell:
// create a temporary file, will get cleaned up var file = TempFile(); // execute PowerShell script, passing in TempFile’s file path Ext.NewTaskWait( "powershell", "d:\\myPowerShell.ps1 -filePath \"" + file.GetFileName() + "\"" ); // read from the file var s = Ext.ReadTextFile( file.GetFileName() ); // do something with PowerShell output Ext.WriteStream( s );
PowerShell:
# pull $filePath parameter from command line arguments param ([Parameter(Mandatory=$true)][string]$filePath ) # write data to the file at the provided path Add-Content $filePath "PowerShell output data"
None.
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.