Вы должны войти, чтобы создавать сообщения и темы.

скрипт выключение компьютера [Решено]

Страница 1 из 4► 4

можно скрипт на выключение компьютера?)

обновить оболчку есть и перезагрузка есть от твикера...


Комментарий модератора:
У нас принято здороваться

извените...

Здравствуйте...

Добрый день 🖐
Пожалуйста. Осторожно, двойной клик по файлу сразу выключит комп.

Лайкнул Psydiant
Psydiant
Цитата: Сергей от 18.03.2021, 17:05

Добрый день 🖐
Пожалуйста. Осторожно, двойной клик по файлу сразу выключит комп.

спасибо,а как изменить иконочку?)

Здравствуйте!
Переместите vbs-скрипт в нужное вам место, далее, создайте ярлык на данный скрипт, на Рабочем столе, например, и в свойствах ярлыка, измените иконку.

Лайкнул Psydiant
Psydiant
Лучший способ помочь себе — помогать другим.
Цитата: Яр от 18.03.2021, 17:22

Здравствуйте!
Переместите vbs-скрипт в нужное вам место, далее, создайте ярлык на данный скрипт, на Рабочем столе, например, и в свойствах ярлыка, измените иконку.

спасибо

Цитата: Сергей от 18.03.2021, 17:05

Добрый день 🖐
Пожалуйста. Осторожно, двойной клик по файлу сразу выключит комп.

Здравствуйте.Можно  скрипт?

Roman, Привет.
Отдельно:

Скрипт

Set objShell = CreateObject("WScript.Shell")
objShell.Run "shutdown -s -t 0"


В Авторском скрипте от Хачатура:
Аргумент Скопировано-shutdown
Скрипт

'Script by XpucT

Set o = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Quit
End If

If WScript.Arguments(0) = "-refresh" Then
    Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
    Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
    Call Shutdown
End If

Sub Refresh
    o.Run "ie4uinit.exe -show"
    o.Run "ie4uinit.exe -ClearIconCache"
    
    WScript.Sleep 1000
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    local = o.ExpandEnvironmentStrings("%LocalAppData%")   
    path = "\Microsoft\Internet Explorer\"
    If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
        fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
    End If
    If fso.FileExists(local & path & "ie4uinit-show.log") Then
        fso.DeleteFile local & path & "ie4uinit-show.log"
    End If
    If fso.FileExists(local & path & "brndlog.txt") Then
        fso.DeleteFile local & path & "brndlog.txt"
    End If
    If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
        fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
    End If
End Sub

Sub Reboot
    o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub

Sub Shutdown
    o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub

«Любой дурак может знать. Дело в том, чтобы понять.» — Альберт Эйнштейн

Спасибо!

Цитата: Mikhail от 29.03.2024, 10:35

Roman, Привет.
Отдельно:

Скрипт

 
 
 
 
Set objShell = CreateObject("WScript.Shell")
objShell.Run "shutdown -s -t 0"
Set objShell = CreateObject("WScript.Shell") objShell.Run "shutdown -s -t 0"
 
Set objShell = CreateObject("WScript.Shell")
objShell.Run "shutdown -s -t 0"


В Авторском скрипте от Хачатура:
Аргумент Скопировано-shutdown
Скрипт

 
 
 
 
'Script by XpucT
 
Set o = WScript.CreateObject("WScript.Shell")
 
If WScript.Arguments.Count = 0 Then
WScript.Quit
End If
 
If WScript.Arguments(0) = "-refresh" Then
Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
Call Shutdown
End If
 
Sub Refresh
o.Run "ie4uinit.exe -show"
o.Run "ie4uinit.exe -ClearIconCache"
 
WScript.Sleep 1000
 
Set fso = CreateObject("Scripting.FileSystemObject")
local = o.ExpandEnvironmentStrings("%LocalAppData%")
path = "\Microsoft\Internet Explorer\"
If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
End If
If fso.FileExists(local & path & "ie4uinit-show.log") Then
fso.DeleteFile local & path & "ie4uinit-show.log"
End If
If fso.FileExists(local & path & "brndlog.txt") Then
fso.DeleteFile local & path & "brndlog.txt"
End If
If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
End If
End Sub
 
Sub Reboot
o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub
 
Sub Shutdown
o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub
'Script by XpucT Set o = WScript.CreateObject("WScript.Shell") If WScript.Arguments.Count = 0 Then WScript.Quit End If If WScript.Arguments(0) = "-refresh" Then Call Refresh ElseIf WScript.Arguments(0) = "-reboot" Then Call Reboot ElseIf WScript.Arguments(0) = "-shutdown" Then Call Shutdown End If Sub Refresh o.Run "ie4uinit.exe -show" o.Run "ie4uinit.exe -ClearIconCache" WScript.Sleep 1000 Set fso = CreateObject("Scripting.FileSystemObject") local = o.ExpandEnvironmentStrings("%LocalAppData%") path = "\Microsoft\Internet Explorer\" If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log" End If If fso.FileExists(local & path & "ie4uinit-show.log") Then fso.DeleteFile local & path & "ie4uinit-show.log" End If If fso.FileExists(local & path & "brndlog.txt") Then fso.DeleteFile local & path & "brndlog.txt" End If If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then fso.DeleteFile local & path & "ie4uinit-UserConfig.log" End If End Sub Sub Reboot o.Run "cmd /c shutdown -r -f -t 0", 0, True End Sub Sub Shutdown o.Run "cmd /c shutdown -s -t 0", 0, True End Sub
 
'Script by XpucT

Set o = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Quit
End If

If WScript.Arguments(0) = "-refresh" Then
    Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
    Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
    Call Shutdown
End If

Sub Refresh
    o.Run "ie4uinit.exe -show"
    o.Run "ie4uinit.exe -ClearIconCache"
    
    WScript.Sleep 1000
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    local = o.ExpandEnvironmentStrings("%LocalAppData%")   
    path = "\Microsoft\Internet Explorer\"
    If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
        fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
    End If
    If fso.FileExists(local & path & "ie4uinit-show.log") Then
        fso.DeleteFile local & path & "ie4uinit-show.log"
    End If
    If fso.FileExists(local & path & "brndlog.txt") Then
        fso.DeleteFile local & path & "brndlog.txt"
    End If
    If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
        fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
    End If
End Sub

Sub Reboot
    o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub

Sub Shutdown
    o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub

Здравствуйте.Подскажите можно добавить в скрипт очистку кеша DNS ?

Roman, Можно.
Скопировано-cleardns

Скрипт

'Script by XpucT

Set o = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Quit
End If

If WScript.Arguments(0) = "-refresh" Then
    Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
    Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
    Call Shutdown
ElseIf WScript.Arguments(0) = "-cleardns" Then
    Call ClearDNSCache
End If

Sub Refresh
    o.Run "ie4uinit.exe -show"
    o.Run "ie4uinit.exe -ClearIconCache"
    
    WScript.Sleep 1000
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    local = o.ExpandEnvironmentStrings("%LocalAppData%")   
    path = "\Microsoft\Internet Explorer\"
    If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
        fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
    End If
    If fso.FileExists(local & path & "ie4uinit-show.log") Then
        fso.DeleteFile local & path & "ie4uinit-show.log"
    End If
    If fso.FileExists(local & path & "brndlog.txt") Then
        fso.DeleteFile local & path & "brndlog.txt"
    End If
    If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
        fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
    End If
End Sub

Sub Reboot
    o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub

Sub Shutdown
    o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub

Sub ClearDNSCache
    o.Run "cmd /c ipconfig /flushdns", 0, True
End Sub

Лайкнул Arman
Arman
«Любой дурак может знать. Дело в том, чтобы понять.» — Альберт Эйнштейн

Большое спасибо!

Цитата: Mikhail от 29.03.2024, 14:47

Roman, Можно.
Скопировано-cleardns

Скрипт

 
 
 
 
'Script by XpucT
 
Set o = WScript.CreateObject("WScript.Shell")
 
If WScript.Arguments.Count = 0 Then
WScript.Quit
End If
 
If WScript.Arguments(0) = "-refresh" Then
Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
Call Shutdown
ElseIf WScript.Arguments(0) = "-cleardns" Then
Call ClearDNSCache
End If
 
Sub Refresh
o.Run "ie4uinit.exe -show"
o.Run "ie4uinit.exe -ClearIconCache"
 
WScript.Sleep 1000
 
Set fso = CreateObject("Scripting.FileSystemObject")
local = o.ExpandEnvironmentStrings("%LocalAppData%")
path = "\Microsoft\Internet Explorer\"
If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
End If
If fso.FileExists(local & path & "ie4uinit-show.log") Then
fso.DeleteFile local & path & "ie4uinit-show.log"
End If
If fso.FileExists(local & path & "brndlog.txt") Then
fso.DeleteFile local & path & "brndlog.txt"
End If
If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
End If
End Sub
 
Sub Reboot
o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub
 
Sub Shutdown
o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub
 
Sub ClearDNSCache
o.Run "cmd /c ipconfig /flushdns", 0, True
End Sub
'Script by XpucT Set o = WScript.CreateObject("WScript.Shell") If WScript.Arguments.Count = 0 Then WScript.Quit End If If WScript.Arguments(0) = "-refresh" Then Call Refresh ElseIf WScript.Arguments(0) = "-reboot" Then Call Reboot ElseIf WScript.Arguments(0) = "-shutdown" Then Call Shutdown ElseIf WScript.Arguments(0) = "-cleardns" Then Call ClearDNSCache End If Sub Refresh o.Run "ie4uinit.exe -show" o.Run "ie4uinit.exe -ClearIconCache" WScript.Sleep 1000 Set fso = CreateObject("Scripting.FileSystemObject") local = o.ExpandEnvironmentStrings("%LocalAppData%") path = "\Microsoft\Internet Explorer\" If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log" End If If fso.FileExists(local & path & "ie4uinit-show.log") Then fso.DeleteFile local & path & "ie4uinit-show.log" End If If fso.FileExists(local & path & "brndlog.txt") Then fso.DeleteFile local & path & "brndlog.txt" End If If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then fso.DeleteFile local & path & "ie4uinit-UserConfig.log" End If End Sub Sub Reboot o.Run "cmd /c shutdown -r -f -t 0", 0, True End Sub Sub Shutdown o.Run "cmd /c shutdown -s -t 0", 0, True End Sub Sub ClearDNSCache o.Run "cmd /c ipconfig /flushdns", 0, True End Sub
 
'Script by XpucT

Set o = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Quit
End If

If WScript.Arguments(0) = "-refresh" Then
    Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
    Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
    Call Shutdown
ElseIf WScript.Arguments(0) = "-cleardns" Then
    Call ClearDNSCache
End If

Sub Refresh
    o.Run "ie4uinit.exe -show"
    o.Run "ie4uinit.exe -ClearIconCache"
    
    WScript.Sleep 1000
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    local = o.ExpandEnvironmentStrings("%LocalAppData%")   
    path = "\Microsoft\Internet Explorer\"
    If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
        fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
    End If
    If fso.FileExists(local & path & "ie4uinit-show.log") Then
        fso.DeleteFile local & path & "ie4uinit-show.log"
    End If
    If fso.FileExists(local & path & "brndlog.txt") Then
        fso.DeleteFile local & path & "brndlog.txt"
    End If
    If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
        fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
    End If
End Sub

Sub Reboot
    o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub

Sub Shutdown
    o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub

Sub ClearDNSCache
    o.Run "cmd /c ipconfig /flushdns", 0, True
End Sub

Доброе утро.Возможно я Вам надоел можете написать что бы показывало окно?С батниками получается с vbs ну ни как.
За ранее спасибо.

Roman, Привет.
Добавил строку Скопированоo.Popup "Кэш сопоставителя DNS успешно очищен.", 1, "DNS Cache", vbInformation + vbOKOnly, "1" это сколько секунд будет окно висеть, либо вообще удали эту строку чтоб самим нажать "ок"

Скрипт

'Script by XpucT

Set o = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Quit
End If

If WScript.Arguments(0) = "-refresh" Then
    Call Refresh
ElseIf WScript.Arguments(0) = "-reboot" Then
    Call Reboot
ElseIf WScript.Arguments(0) = "-shutdown" Then
    Call Shutdown
ElseIf WScript.Arguments(0) = "-cleardns" Then
    Call ClearDNSCache
End If

Sub Refresh
    o.Run "ie4uinit.exe -show"
    o.Run "ie4uinit.exe -ClearIconCache"
    
    WScript.Sleep 1000
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    local = o.ExpandEnvironmentStrings("%LocalAppData%")   
    path = "\Microsoft\Internet Explorer\"
    If fso.FileExists(local & path & "ie4uinit-ClearIconCache.log") Then
        fso.DeleteFile local & path & "ie4uinit-ClearIconCache.log"
    End If
    If fso.FileExists(local & path & "ie4uinit-show.log") Then
        fso.DeleteFile local & path & "ie4uinit-show.log"
    End If
    If fso.FileExists(local & path & "brndlog.txt") Then
        fso.DeleteFile local & path & "brndlog.txt"
    End If
    If fso.FileExists(local & path & "ie4uinit-UserConfig.log") Then
        fso.DeleteFile local & path & "ie4uinit-UserConfig.log"
    End If
End Sub

Sub Reboot
    o.Run "cmd /c shutdown -r -f -t 0", 0, True
End Sub

Sub Shutdown
    o.Run "cmd /c shutdown -s -t 0", 0, True
End Sub

Sub ClearDNSCache
    o.Run "cmd /c ipconfig /flushdns", 0, True
    o.Popup "Кэш сопоставителя DNS успешно очищен.", 1, "DNS Cache", vbInformation + vbOKOnly
End Sub

Лайкнул Roman
Roman
«Любой дурак может знать. Дело в том, чтобы понять.» — Альберт Эйнштейн
Страница 1 из 4► 4