Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Meerkat
- Posts: 89
- Joined: 19 Jul 2015 02:27
- Location: Philippines
#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
#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: 2009
- Joined: 23 Jun 2013 06:15
- Location: Germany
#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
-
Meerkat
- Posts: 89
- Joined: 19 Jul 2015 02:27
- Location: Philippines
#5
Post
by Meerkat » 21 Dec 2015 06:21
Before, yea... but an outdated one. Thanks!