Создание vbs файла через Echo
Цитата: Удаленный пользователь от 23.06.2022, 13:58Всем добрый день, помогите пожалуйста сне нужно создать файл SafeMode.vbs в котором будут строчки
[spoiler title="Строчки"]
if Wscript.Arguments.Count = 0 then
Wscript.Quit
end ifset arg = Wscript.Arguments
set run = WScript.CreateObject("WScript.Shell")if arg(0) = "reboot" then
run.Run "cmd /c bcdedit /deletevalue {current} safeboot & shutdown -r -f -t 0", 0, true
elseif arg(0) = "safemode" then
run.Run "cmd /c bcdedit /set {current} safeboot minimal & shutdown -r -f -t 0", 0, true
elseif arg(0) = "cmd" then
run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, true
elseif arg(0) = "network" then
run.Run "cmd /c bcdedit /set {current} safeboot network & shutdown -r -f -t 0", 0, true
end if
[/spoiler]
Нужно его создать через echo
Я попробовал и [spoiler title="Код"]
Echo if Wscript.Arguments.Count = 0 then >SafeMode.vbs
Echo Wscript.Quit>>SafeMode.vbs
Echo end if>>SafeMode.vbs
Echo. >>SafeMode.vbs
Echo set arg = Wscript.Arguments>>SafeMode.vbs
Echo set run = WScript.CreateObject("WScript.Shell")>>SafeMode.vbs
Echo. >>SafeMode.vbs
Echo if arg(0) = "reboot" then>>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /deletevalue {current} safeboot & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "safemode" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "cmd" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} >>SafeMode.vbs
Echo safebootalternateshell yes & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "network" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot network & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo end if >>SafeMode.vbs
[/spoiler]
Но некоторые строчки не записываются, а именно
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} >>SafeMode.vbs
Echo safebootalternateshell yes & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Всем добрый день, помогите пожалуйста сне нужно создать файл SafeMode.vbs в котором будут строчки
if Wscript.Arguments.Count = 0 then
Wscript.Quit
end if
set arg = Wscript.Arguments
set run = WScript.CreateObject("WScript.Shell")
if arg(0) = "reboot" then
run.Run "cmd /c bcdedit /deletevalue {current} safeboot & shutdown -r -f -t 0", 0, true
elseif arg(0) = "safemode" then
run.Run "cmd /c bcdedit /set {current} safeboot minimal & shutdown -r -f -t 0", 0, true
elseif arg(0) = "cmd" then
run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, true
elseif arg(0) = "network" then
run.Run "cmd /c bcdedit /set {current} safeboot network & shutdown -r -f -t 0", 0, true
end if
Нужно его создать через echo
Я попробовал и
Echo if Wscript.Arguments.Count = 0 then >SafeMode.vbs
Echo Wscript.Quit>>SafeMode.vbs
Echo end if>>SafeMode.vbs
Echo. >>SafeMode.vbs
Echo set arg = Wscript.Arguments>>SafeMode.vbs
Echo set run = WScript.CreateObject("WScript.Shell")>>SafeMode.vbs
Echo. >>SafeMode.vbs
Echo if arg(0) = "reboot" then>>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /deletevalue {current} safeboot & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "safemode" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "cmd" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} >>SafeMode.vbs
Echo safebootalternateshell yes & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo elseif arg(0) = "network" then >>SafeMode.vbs
Echo run.Run "cmd /c bcdedit /set {current} safeboot network & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Echo end if >>SafeMode.vbs
Но некоторые строчки не записываются, а именно
Echo run.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} >>SafeMode.vbs
Echo safebootalternateshell yes & shutdown -r -f -t 0", 0, true >>SafeMode.vbs
Цитата: Удаленный пользователь от 23.06.2022, 14:17Добрый🖐.
Кавычки?, в конце({current}) и в начале (safebootalternateshell).
Добрый🖐.
Кавычки?, в конце({current}) и в начале (safebootalternateshell).
Цитата: Удаленный пользователь от 23.06.2022, 14:29Добрый день.
Еслиrun.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, trueэто одна строка, зачем разбиваете её на две?
Добрый день.
Если Скопированоrun.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, true это одна строка, зачем разбиваете её на две?
Цитата: Удаленный пользователь от 23.06.2022, 14:38Цитата: Adler от 23.06.2022, 14:29Добрый день.
Еслиrun.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, trueэто одна строка, зачем разбиваете её на две?Ой точно не заметил что разделил, спасибо
Цитата: Adler от 23.06.2022, 14:29Добрый день.
ЕслиСкопированоrun.Run "cmd /c bcdedit /set {current} safeboot minimal & bcdedit /set {current} safebootalternateshell yes & shutdown -r -f -t 0", 0, trueэто одна строка, зачем разбиваете её на две?
Ой точно не заметил что разделил, спасибо