脚本Shell CMD未运行

时间:2017-03-08 19:32:57

标签: batch-file cmd

我运行Windows 10而无法在.bat

中执行脚本shell

所以,我的代码是:

@echo off
echo .  
echo MsgBox "TA MERE"
echo .
echo MsgBox "Salut ca va?"
> msgbox.vbs
cscript msgbox.vbs
loop

所以,我的脚本正在运行,但脚本没有在桌面上创建msgbox.vbs文件,程序关闭Windows

2 个答案:

答案 0 :(得分:2)

这是基于我认为你的脚本应该做的猜测:

@echo off
(   echo.  
    echo MsgBox "TA MERE"
    echo.
    echo MsgBox "Salut ca va?"
)> msgbox.vbs
cscript msgbox.vbs

我错过了loop,因为我不知道你要去哪里。

答案 1 :(得分:1)

你可以尝试这样的事情:

@echo off
REM We create our vbs file in temporary folder
REM If you want to create your vbs file on your desktop
REM Just Replace this line set "VBSFile=%Tmp%\%~n0.vbs" to
REM set "VBSFile=%userprofile%\desktop\%~n0.vbs"
set "VBSFile=%Tmp%\%~n0.vbs"
(     
    echo MsgBox "TA MERE TOI MEME LOL !",vbExclamation,"TA MERE TOI MEME LOL !"
    echo MsgBox "Salut Comment ca va ?",VbQuestion,"TA MERE TOI MEME LOL !"
)> "%VBSFile%"
REM We execute our vbs file
cscript /nologo "%VBSFile%"
REM We Clean our vbs file
Del "%VBSFile%"