Problems with Batch-VBS Hybrid

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Meerkat
Posts: 89
Joined: 19 Jul 2015 02:27
Location: Philippines

Problems with Batch-VBS Hybrid

#1 Post by Meerkat » 19 Dec 2015 00:55

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

Yury
Posts: 115
Joined: 28 Dec 2013 07:54

Re: Problems with Batch-VBS Hybrid

#2 Post by Yury » 19 Dec 2015 04:51

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...
:) !

penpen
Expert
Posts: 1992
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Problems with Batch-VBS Hybrid

#3 Post by penpen » 19 Dec 2015 06:18

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

siberia-man
Posts: 208
Joined: 26 Dec 2013 09:28
Contact:

Re: Problems with Batch-VBS Hybrid

#4 Post by siberia-man » 21 Dec 2015 05:54

@Meerkat:
Have you tried this script viewtopic.php?f=3&t=5543&p=37780#p37780 ?

Meerkat
Posts: 89
Joined: 19 Jul 2015 02:27
Location: Philippines

Re: Problems with Batch-VBS Hybrid

#5 Post by Meerkat » 21 Dec 2015 06:21

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

Post Reply