Page 1 of 1

Problems with Batch-VBS Hybrid

Posted: 19 Dec 2015 00:55
by Meerkat
While I am writing a Batch-VBS hybrid using <SUB> character, GOTOs and (maybe) CALLs does not work.

Code: (Just a demo)

Code: Select all

::'@echo off
remgoto :a
remrem Some codes here...
rem:a
remecho This will be displayed!
rempause

remrem Some VBS codes here...

Output:

Code: Select all

The system cannot find the batch label specified - a


Is there any workaround on this? Thanks a lot! :)

Meerkat

Re: Problems with Batch-VBS Hybrid

Posted: 19 Dec 2015 04:51
by Yury
Meerkat wrote:Is there any workaround on this?


Code: Select all

::'@echo off
remgoto rem
remrem Some codes here...
:rem
remecho This will be displayed!
rempause

remrem Some VBS codes here...
:) !

Re: Problems with Batch-VBS Hybrid

Posted: 19 Dec 2015 06:18
by penpen
You could also encapsulate the batch part in a sub and realize labels with string assignments (but you have to avoid vbs keynames, such as "sub"):

Code: Select all

::'@echo off
remgoto main
sub batchPart()
:main = ""
remcall :info
remcscript //E:VBS //Nologo "%~f0"
rempause
remgoto :eof

:info = ""
remecho BAT output.
remgoto :eof

end sub

WScript.Echo "VBS output."
Sidenote: You could also use http://www.dostips.com/forum/viewtopic.php?p=33963#p33963 which i prefer.


penpen

Re: Problems with Batch-VBS Hybrid

Posted: 21 Dec 2015 05:54
by siberia-man
@Meerkat:
Have you tried this script viewtopic.php?f=3&t=5543&p=37780#p37780 ?

Re: Problems with Batch-VBS Hybrid

Posted: 21 Dec 2015 06:21
by Meerkat
siberia-man wrote:@Meerkat:
Have you tried this script http://www.dostips.com/forum/viewtopic. ... 780#p37780 ?


Before, yea... but an outdated one. Thanks! :D