Visualizzazione dei risultati da 1 a 10 su 10

Discussione: eseguire un exe

  1. #1

    eseguire un exe

    ragazzi ho la necessita' di far partire un .exe come ad esempio notepad o la calcolatrice con asp, sul server questi applicativi sono installati mentre sul client sono assenti.

    Si puo' fare in qualche modo?

  2. #2
    Utente di HTML.it L'avatar di Gioba66
    Registrato dal
    Jun 2002
    Messaggi
    2,189
    se sei in hosting, scordatelo
    se il server è tuo, invece, puoi installare la componenete gratuita aspexec (www.serverobjects.com) oppure usare WSHELL. fai una ricerca su google per alcuni esempi di codice.
    Tutti vogliono parlare, nessuno sa ascoltare.

  3. #3
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    Questo è un post di non molto tempo fa:

    Questa è una classe per eseguire programmi (mettila in Shell.asp):


    codice:
    Class cShell
    	Public WScript
    	Public Output
    	Public Error
    	Private Sub Class_Initialize()
    		Set WScript = Server.CreateObject("WScript.Shell")
    	End Sub
    
    	Public Function Execute(commandLine)
    	Dim oExec
    		on error resume next
    			Set oExec = WScript.Exec(commandLine)
    			If Err.number <> 0 then
    				Response.Write("<p style='font-family:verdana;font-size:11px'>Shell Error
    "& Err.Description & "
    CommandLine : " & commandLine)
    				Response.End
    			end if
    		on error goto 0
    		Error = False
    		Output = oExec.StdOut.ReadAll()
    		if Output="" then
    			Output = oExec.StdErr.ReadAll()
    			Error = True
    		End If
    		Execute = Error
    	End Function
    	
    	Private Sub Class_Terminate()
    		Set WScript = nothing
    	End Sub
    
    End Class

    Un esempio:


    codice:
    
    Set Shell = new cShell
    Response.Write("<BODY style='font-size:11px;font-family:verdana'>")
    Response.Write ("Questa è un'esecuzione senza errori (return code=0): " & "
    ")
    Response.Write("<dir>")
    Response.Write("Execute"& Shell.Execute("cmd /?") & "
    ")
    Response.Write("Error:"&Shell.Error & "
    ")
    Response.Write("Output:"&Shell.Output & "
    ")
    Response.Write("</dir>")
    
    Response.Write ("Questo genera un errore del programma eseguito (return code <>0): " & "
    ")
    Response.Write("<dir>")
    Response.Write("Execute:"&Shell.Execute("cmd /rf") & "
    ")
    Response.Write("Error:"&Shell.Error & "
    ")
    Response.Write("Output:"&Shell.Output & "
    ")
    Response.Write("</dir>")
    
    Response.Write ("Il programma non esiste : 
    ")
    Response.Write(Shell.Execute("cmd1") & "
    ")
    Response.Write("</body>")
    Set Shell = Nothing

    Funziona così:

    Shell.Execute

    Esegue un programma se non lo trova viene bloccata l'esecuzione
    Se il programma termina con un codice 0 restituisce false e Error sarà false.

    Shell.Error

    Ottiene se l'ultimo programma eseguito ha generato un errore.

    Shell.Output

    Ottiene l'output dell'ultimo programma eseguito.

  4. #4
    ora mis tudio il tuo script cmq stavo facendo una cosa del genere:

    set shell = server.CreateObject("Wscript.Shell")
    note = "C:\WINNT\system32\calc.exe"
    Set whsRun = Shell.run(note, 0)
    set whsRun = nothing

    ma mi rimane in caricamento..cosa sbaglio?

  5. #5
    Esiste qualcosa di simile, magari in javascript che faccia eseguire un programma sulla macchina del client dopo il suo esplicito consenso?

    Ciao Antonio.
    Vuoi guadagnare con il tuo sito ?
    affiliati con noi e riceverai ottime percentuali !!!
    Travellero Affiliate Program
    Scambia link con noi

  6. #6
    allora.ho provato lo script ma midce che nn ho i permessi, ho settato di tutto a everyone ma nn so piu dove mettere le mani..pero ho notato che sul server principale qualcosa si vede..anche se mettendo una cal.exe si inchioda tutto..!

  7. #7
    ok un problema e' risolto..el autorizzazione so apposto..ora perche anche in locale mi si inchioda tutto quando eseguo la calcolatrice?

  8. #8
    ludoweb,

    anche me da : Accesso negato.

    tu come hai risolto ?

  9. #9
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    devi metter i permessi di esecuzione sulla cartella.

  10. #10
    Utente di HTML.it
    Registrato dal
    Mar 2006
    Messaggi
    10
    Originariamente inviato da Baol74
    Questo è un post di non molto tempo fa:

    Questa è una classe per eseguire programmi (mettila in Shell.asp):


    codice:
    Class cShell
    	Public WScript
    	Public Output
    	Public Error
    	Private Sub Class_Initialize()
    		Set WScript = Server.CreateObject("WScript.Shell")
    	End Sub
    
    	Public Function Execute(commandLine)
    	Dim oExec
    		on error resume next
    			Set oExec = WScript.Exec(commandLine)
    			If Err.number <> 0 then
    				Response.Write("<p style='font-family:verdana;font-size:11px'>Shell Error
    "& Err.Description & "
    CommandLine : " & commandLine)
    				Response.End
    			end if
    		on error goto 0
    		Error = False
    		Output = oExec.StdOut.ReadAll()
    		if Output="" then
    			Output = oExec.StdErr.ReadAll()
    			Error = True
    		End If
    		Execute = Error
    	End Function
    	
    	Private Sub Class_Terminate()
    		Set WScript = nothing
    	End Sub
    
    End Class

    Un esempio:


    codice:
    
    Set Shell = new cShell
    Response.Write("<BODY style='font-size:11px;font-family:verdana'>")
    Response.Write ("Questa è un'esecuzione senza errori (return code=0): " & "
    ")
    Response.Write("<dir>")
    Response.Write("Execute"& Shell.Execute("cmd /?") & "
    ")
    Response.Write("Error:"&Shell.Error & "
    ")
    Response.Write("Output:"&Shell.Output & "
    ")
    Response.Write("</dir>")
    
    Response.Write ("Questo genera un errore del programma eseguito (return code <>0): " & "
    ")
    Response.Write("<dir>")
    Response.Write("Execute:"&Shell.Execute("cmd /rf") & "
    ")
    Response.Write("Error:"&Shell.Error & "
    ")
    Response.Write("Output:"&Shell.Output & "
    ")
    Response.Write("</dir>")
    
    Response.Write ("Il programma non esiste : 
    ")
    Response.Write(Shell.Execute("cmd1") & "
    ")
    Response.Write("</body>")
    Set Shell = Nothing

    Funziona così:

    Shell.Execute

    Esegue un programma se non lo trova viene bloccata l'esecuzione
    Se il programma termina con un codice 0 restituisce false e Error sarà false.

    Shell.Error

    Ottiene se l'ultimo programma eseguito ha generato un errore.

    Shell.Output

    Ottiene l'output dell'ultimo programma eseguito.
    Scusate l'infinita ignoranza... ma il comando dove va' messo?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.