leprecon
1.
Код:

$string = "C:\Program Files\1123\dfgfdfgdg.exe"
$result = StringRegExpReplace($string, "^.*\\", "")
MsgBox(0, "", $result)
2.
Код:

$hFileOpen = FileOpen(@TempDir & "\tmp.au3", 2)
$val = "Hello world!"
$string = 'Sleep(2000)' & @LF & _
'Global $Var = "' & $val & '"' & @LF & _
'GUICreate("Test", 200, 100)' & @LF & _
'GUICtrlCreateLabel($Var, 50, 50, 100, 16)' & @LF & _
'GUISetState()' & @LF & _
'Do' & @LF & _
'Until GuiGetMsg() = -3'
FileWrite($hFileOpen, $string)
FileClose($hFileOpen)
Run("c:\Program Files\AutoIt3\AutoIt3.exe " & @TempDir & "\tmp.au3")
Я реализовал подобное в своём
проекте