TempFile GetFileName() Method

Gets the full file name with path.

Function Signature

 string GetFileName()

Parameters

Parameter Type Description

None

Return

Type Description

string

The full file path.

Technical Details

SBM ModScript version: 11.4.

Example

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"  

Notes

None.

Related Topics

TempFile