Fork: Difference between revisions
Content deleted Content added
Updated to make the program able to compile and execute. Added output. |
Fork en FreeBASIC |
||
Line 669: | Line 669: | ||
child pid ez volt: 2123 |
child pid ez volt: 2123 |
||
</pre> |
</pre> |
||
=={{header|FreeBASIC}}== |
|||
En Windows sin usar windows.bi, podemos usar un comando vbscript |
|||
<lang freebasic> |
|||
Function script(s As String) As String |
|||
Dim As String g = _ |
|||
"Set WshShell = WScript.CreateObject(""WScript.Shell"")" + _ |
|||
Chr(13,10) + "Return = WshShell.Run("""+s+" "",1,0)" |
|||
Return g |
|||
End Function |
|||
Function guardaArchivo(nombreArchivo As String, p As String) As String |
|||
Dim As Long n = Freefile |
|||
If Open (nombreArchivo For Binary Access Write As #n) = 0 Then |
|||
Put #n,,p |
|||
Close |
|||
Else |
|||
Print "No se puede guardar " + nombreArchivo : Sleep : End |
|||
End If |
|||
Return nombreArchivo |
|||
End Function |
|||
Sub ejecutaScript(nombreArchivo As String) |
|||
Shell "cscript.exe /Nologo " + nombreArchivo |
|||
End Sub |
|||
Var g = script("notepad.exe") '<< ejecuta este .exe (notepad como demo) |
|||
guardaArchivo("script.vbs",g) |
|||
ejecutaScript("script.vbs") |
|||
Dim As String s |
|||
Print "Hola" |
|||
Input "Teclee algo: ", s |
|||
Print s |
|||
Kill "script.vbs" |
|||
Sleep |
|||
</lang> |
|||