Visualizzazione dei risultati da 1 a 3 su 3

Discussione: problemi vbs to exe

  1. #1

    problemi vbs to exe

    allora ho uno script per far partire defrag.exe con i privilegi di administrator...se lo faccio partire da vbs funziona perfettamente....mentre se lo converto in exe parte...ma mi apre anche la finestra dove mi chiede di inserire la password per runas...cosa posso fare?


    codice:
    On Error Resume Next
    dim WshShell,FSO
    
    wscript.echo "Sta per partire il programma per la deframmentazione del disco. Attendere che la deframmentazione sia completata, non utilizzare il PC. Per eventuali problema rivolgersi all'heldpesk."
    
    
    sUser="Administrator"	
    sPass="password"&VBCRLF
    sCmd="defrag.exe C:"
    
    
    
    set WshShell = CreateObject("WScript.Shell")
    set WshEnv = WshShell.Environment("Process")
    WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
    set FSO = CreateObject("Scripting.FileSystemObject")
    
    if FSO.FileExists(winpath) then
    'wscript.echo winpath & " " & "verified"
    else
    wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath &"." & VBCRLF & "You must be running Windows 2000 for this script to work."
    set WshShell=Nothing
    set WshEnv=Nothing
    set FSO=Nothing
    wscript.quit
    end if
    
    rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
    Wscript.Sleep 30 'need to give time for window to open.
    WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
    WshShell.SendKeys sPass 'send the password to the waiting window.
    
    set WshShell=Nothing
    
    set WshEnv=Nothing
    set FSO=Nothing
    
    wscript.quit
    
    '************************
    '* Usage Subroutine *
    '************************
    Sub Usage()
    On Error Resume Next
    msg="Usage: cscript|wscript vbrunas.vbs Username Password Command" & VBCRLF & VBCRLF & "You should use the full path where necessary and put long file names or commands" & VBCRLF & "with parameters in quotes" & VBCRLF & VBCRLF &"For example:" & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog e:\scripts\admin.vbs" & VBCRLF & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog " & CHR(34) &"e:\program files\scripts\admin.vbs 1stParameter 2ndParameter" & CHR(34)& VBCRLF & VBCRLF & VBCLRF & "cscript vbrunas.vbs /?|-? will display this message."
    
    wscript.echo msg
    
    wscript.quit
    
    end sub
    La programmazione è una scelta di vita....

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Ma lo trasformi in exe usando cosa? E quale codice hai quando lo trasformi?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  3. #3
    Originariamente inviato da oregon
    Ma lo trasformi in exe usando cosa? E quale codice hai quando lo trasformi?
    Con Vbs To Exe...il codice rimane così
    La programmazione è una scelta di vita....

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.