我想将以下简单的 vbs 文件转换成批处理文件 .bat

I'd like the following simple vbs file converted into a batch file .bat

我想将以下简单的 vbs 文件转换成批处理文件 .bat 我试过很多转换器,都失败了。 我希望消息在文件启动后的某个时刻在批处理文件中播放。

Dim speaks, speech
speaks="Welcome to your PC, %USERNAME%"
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks

您可以编写类似的内容来生成 vbs 文件并使用批处理文件执行它:


@echo off
Title Speak IT !
Set "Msg=Welcome to your PC, %USERNAME% !"
echo(
echo "%Msg%"
Call :SpeakIT "%Msg%"
Pause>nul & Exit /B
:SpeakIT <Msg>
::-----------------------------------------------
(
echo    Dim speaks, speech
echo    speaks="%~1"
echo    Set speech=CreateObject("sapi.spvoice"^)
echo    speech.Speak speaks
)>"%temp%\%~n0.vbs"
Cscript //Nologo "%temp%\%~n0.vbs"
Exit /B
::-----------------------------------------------