Jump to content











Photo
- - - - -

Running Grub4Dos Batch Files (.g4b)

grub4dos batch file .g4b

  • Please log in to reply
7 replies to this topic

#1 abigt

abigt
  • Members
  • 6 posts

Posted 23 June 2021 - 06:24 AM

Hi Everyone,

 

I have these two basic questions:

 

1- How to run a Grub4Dos Batch File (.g4b ) manually from the Grub4Dos's commandline?

2- How to run a Grub4Dos Batch File (.g4b ) automatically from Grub4Dos's menu.lst?

 

Thanks 



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 23 June 2021 - 07:02 AM

You just invoke it, like you would do on DOS or in a command prompt in windows .

 

Assuming the batch file name is "mybatch.g4b" AND it is in the SAME volume in which you have established root, you simply type:

/mybatch.g4b

(and press [ENTER] if on command line)

 

If the file is in another volume or in a subdirectory you need to provide the path to it or change current root to it.

 

Another example (with a full path):

(hd0,0)/grub4dos/mybatch.g4b

[ENTER]

 

If you are already on that volume, i.e.

root

[ENTER]

(hd0,0)

you can call it with:

/grub4dos/mybatch.g4b

[ENTER]

 

Or you can use find --set-root to change the current root, and even change current root to a directory or subdirectory (but this latter is generally speaking is not the smartest choice, as you will probably need to change root again to invoke other commands, access other files, etc. )

 

Recent versions of grub4dos have a command, curiously named command (probably intended pun ;)) that allows to set a path where to look for executable files and to set/change the extension for such files.

 

If the extension is set (to g4b as an example) AND the executable is in the set path (default is (bd)/boot/grub, extension not set), then you can run the batch even without extension and without path, i.e.:

mybatch[ENTER]

 

Both on command line and in batch you can use the above syntax or use the call command. i.e.:

call (hd0,0)/grub4dos//mybatch

 

After the name of the batch you can put (if needed) the parameters, like on DOS or windows command prompt, example:

 

mybatch parameter1 parameter2 

[ENTER]

 

:duff:

Wonko



#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 June 2021 - 07:05 AM

Grub4dos batch files must start with the first line as
!BAT

#4 abigt

abigt
  • Members
  • 6 posts

Posted 23 June 2021 - 07:45 AM

First, Thank you guys for your quick replies...

 

I tried all the solutions proposed by "Wonko the Sane" but it didn't work (I got "Error 27: Unrecognized command").

 

And as "steve6375" advised, I confirmed that my batch file starts with !BAT

 

But let me tell you guys what I am doing:

 

I am trying to make a bootable Grub4Dos ISO CD/DVD Image File, So I followed these steps:

 

- Creating an empty folder named "content"

- Extracting grub4dos-0.4.4 files to "content" folder

- Copying a test batch file KBD_FRENCH.g4b to "content" folder. I got it from easy2boot (it supposed to change the keyboard layout to french)

- Using Oscdimg tool to make the ISO: oscdimg -d -n -m -bcontent\grldr -e content test.iso

 

I tried to boot the ISO File using Virtual Box VM and it worked well...

The menu is loaded and everything is well except that I was not able to run KBD_FRENCH.g4b

I tried all of:

/KBD_FRENCH.g4b

(cd)/KBD_FRENCH.g4b

I tried to rename KBD_FRENCH.g4b to just fr.g4b and remake the ISO but the result is always the same: "Error 27: Unrecognized command"

 

When I run ls command the file (KBD_FRENCH.g4b) is there among grldr,  grub.exe and others but it can't be invoked.


Edited by abigt, 23 June 2021 - 07:47 AM.


#5 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 June 2021 - 08:01 AM

grub4dos is version 0.4.6a

0.4.4 is very very old!

Use \grldr file from easy2boot which is a known good version

Why not get the easy2boot grub4dos eBook?

https://easy2boot.xyz/ebooks/



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 23 June 2021 - 09:17 AM

The possibility of having batch files in grub4dos started in some 0.4.5 version.

 

0.4.4 grub4dos does NOT exist, the releases have also a date/timestamp, and there is an abyss between (say) 0.4.4 2009-03-31 and 0.4.4 2009-10-16 (this latter is the ONLY version of 0.4.4 grub4dos you should be using, but of course it doesn't have batch capabilities).

 

Get latest 0.4.6.a:
https://github.com/c...ases/tag/0.4.6a

http://grub4dos.chen....6a-2021-06-02/

 

Or latest 0.4.5.c:

http://grub4dos.chen....5c-2016-01-18/

 

:duff:

Wonko



#7 abigt

abigt
  • Members
  • 6 posts

Posted 23 June 2021 - 07:51 PM

Ok thank you guys, It worked in the recent versions of Grub4Dos. 



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 24 June 2021 - 09:26 AM

Ok thank you guys, It worked in the recent versions of Grub4Dos. 

Good :).

 

As a side-side note, should you need/want some personalization/customization of the keyboard layout, there is a (hopefully handy) spreadsheet here:

http://reboot.pro/in...ic=8056&p=68522

that may be useful as a "base".

 

:duff:

Wonko






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users