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?
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?
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.
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.
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?
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
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..!
ok un problema e' risolto..el autorizzazione so apposto..ora perche anche in locale mi si inchioda tutto quando eseguo la calcolatrice?
ludoweb,
anche me da : Accesso negato.
tu come hai risolto ?
devi metter i permessi di esecuzione sulla cartella.
Scusate l'infinita ignoranza... ma il comando dove va' messo?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.