Programmieren - alles kontrollieren 4.940 Themen, 20.676 Beiträge

Script startet von neuem!

sczakiju / 4 Antworten / Flachansicht Nickles

Hallo ich habe einen Script in VBScript geschrieben:
Frage = Msgbox ("Möchten Sie Medion Home Cinema jetz starten?", vbyesno, "Home Cinema starten?")

If Frage = VbYes then
set WshShell = WScript.CreateObject("WScript.Shell")
Wshshell.run ("%systemdrive%\Progra~1\HomeCi~1\PowerC~1\PCM3.exe")
end if

Zeit = Inputbox ("Tippen Sie bitte die Zahl in Minuten ein, in der, der Computer herruntergefahren sein soll!", "Zeit festlegen", "nur 15, 30, 45, 60, 90, 120")

If Zeit = "15" then
Dim fso1, Shutdown1
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set Shutdown1 = fso1.CreateTextFile("C:\temp\shutdown1.bat", True)
Shutdown1.WriteLine("shutdown -s -t 900")
Shutdown1.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown1.bat")
end If

If Zeit = "30" then
Dim fso2, Shutdown2
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set Shutdown2 = fso2.CreateTextFile("C:\Temp\shutdown2.bat", True)
Shutdown2.WriteLine("shutdown -s -t 1800")
Shutdown2.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown2.bat")
end if

If Zeit = "45" then
Dim fso3, Shutdown3
Set fso3 = CreateObject("Scripting.FileSystemObject")
Set Shutdown3 = fso3.CreateTextFile("C:\Temp\shutdown3.bat", True)
Shutdown3.WriteLine("shutdown -s -t 2700")
Shutdown3.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown3.bat")
end if

If Zeit = "60" then
Dim fso4, Shutdown4
Set fso4 = CreateObject("Scripting.FileSystemObject")
Set Shutdown4 = fso4.CreateTextFile("C:\Temp\shutdown4.bat", True)
Shutdown4.WriteLine("shutdown -s -t 3600")
Shutdown4.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown4.bat")
end if

If Zeit = "90" then
Dim fso5, Shutdown5
Set fso5 = CreateObject("Scripting.FileSystemObject")
Set Shutdown5 = fso5.CreateTextFile("C:\Temp\shutdown5.bat", True)
Shutdown5.WriteLine("shutdown -s -t 5400")
Shutdown5.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown5.bat")
end if

If Zeit = "120" then
Dim fso6, Shutdown6
Set fso6 = CreateObject("Scripting.FileSystemObject")
Set Shutdown6 = fso6.CreateTextFile("C:\Temp\shutdown6.bat", True)
Shutdown6.WriteLine("shutdown -s -t 7200")
Shutdown6.Close
set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run ("C:\Temp\shutdown6.bat")
wshshell.close
end if

------------------------------


Dieser startet aber neu wenn ich die Zeit die ich haben will eingebe? Woran liegt das?

Zeit ist das, was man an der Uhr abliest. (Albert Einstein)
bei Antwort benachrichtigen
Danke sczakiju
Borlander sczakiju „Danke“
Optionen

:-) Woran lag es denn jetzt? Nur am fehlenden Paramter -t ?

bei Antwort benachrichtigen