hacker


Ingresar con nombre de usuario, contraseña y duración de la sesión
| Portal Hacker | Editorial | Descargas | Ezine |
Inicio Ayuda Ingresar Registrarse
09 de Julio de 2008, 06:50:03
Noticias: Que importa si no sabes programar, CPH te enseña, solo haz click
Para ver este enlace Registrate o Inicia Sesion
Aquí

+  Foros pOrtal Hacker
|-+  Programacion
| |-+  Programación en general
| | |-+  Visual Basic (Moderadores: ranefi, crypto136, ziBboh, >> s E t H <<)
| | | |-+  VBS: Copiar archivo al directorio donde es ejecutado el script.
0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: VBS: Copiar archivo al directorio donde es ejecutado el script.  (Leído 121 veces)
rhp07
NZ1
*
Desconectado Desconectado

Mensajes: 33


Ver Perfil
« : 07 de Diciembre de 2007, 02:45:30 »

Bueno mirad este script:
----------------------------------------------------------------------------------------------------------------------------
HTTPDownload "http://servidor.es/archivo.txt", "C:/"

Sub HTTPDownload( myURL, myPath )
' This Sub downloads the FILE specified in myURL to the path specified in myPath.
'
' myURL must always end with a file name
' myPath may be a directory or a file name; in either case the directory must exist
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
'
' Based on a script found on the Thai Visa forum
' http://www.thaivisa.com/forum/index.php?showtopic=21832

    ' Standard housekeeping
    Dim i, objFile, objFSO, objHTTP, strFile, strMsg
    Const ForReading = 1, ForWriting = 2, ForAppending = 8

    ' Create a File System Object
    Set objFSO = CreateObject( "Scripting.File SystemObject" )

    ' Check if the specified target file or folder exists,
    ' and build the fully qualified path of the target file
    If objFSO.FolderE xists( myPath ) Then
        strFile = objFSO.BuildPa th( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
    ElseIf objFSO.FolderE xists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
        strFile = myPath
    Else
        WScript.Echo "ERROR: Target folder not found."
        Exit Sub
    End If

    ' Create or open the target file
    Set objFile = objFSO.OpenTex tFile( strFile, ForWriting, True )

    ' Create an HTTP object
    Set objHTTP = CreateObject( "WinHttp.WinHtt pRequest.5.1" )

    ' Download the specified URL
    objHTTP.Open "GET", myURL, False
    objHTTP.Send

    ' Write the downloaded byte stream to the target file
    For i = 1 To LenB( objHTTP.Respon seBody )
        objFile.Write Chr( AscB( MidB( objHTTP.Respon seBody, i, 1 ) ) )
    Next

    ' Close the target file
    objFile.Close( )
End Sub
-----------------------------------------------------------------------------------------------------------
Lo que está en rojo lo quiero cambiar por el directorio desde el que se está ejecutando el archivo ".vbs". Lo escribiría manualmente, pero ahi va el problema, es para una aplicación portable! Como cambiar esto para que lo copie al directorio de ejecución?
En línea
Páginas: [1] Ir Arriba Imprimir 
« anterior próximo »
Ir a:  


Ingresar con nombre de usuario, contraseña y duración de la sesión

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC hacker

Juegos gratis - Articulos PHP - Juegos - Trucos - Letras - Juegos - Juegos Online