Help with Batch File

Associate
Joined
31 Jan 2010
Posts
282
Location
UK
I haven't really played with batch files since back in the day when I was running MS-DOS 5.0 :D

I have created a batch file that will install an OEM Logo and Information on Windows Vista and Windows 7. This is fine but it only works if the the system drive is "C".

Can someone add something in after the pause command so that they have to press corresponding key for their drive. For example if their system drive is "D" they would press the "D" button and it will carry on installing to that drive.

I would also love to turn this script into a .EXE file and have an icon for it, so if anyone knows of any good .BAT to .EXE converters please let me know.

Thanks In Advance :)

Code:
@echo off
cls
echo This installer will install your OEM
echo Information to your Windows Vista or
echo Windows 7 Computer.
echo.
echo This installer is NOT compatible with XP
echo or any other Windows Version.
echo.
echo.
echo.
pause
copy OEMLogo.bmp C:\windows\system32
OEMLogo.reg
 
Soldato
Joined
13 Sep 2003
Posts
8,441
Location
Glocestershire
Is it really that easy?? :D Now I feel stupid.

Does anyone know how to compile the batch file as a .EXE file and add an icon to it?

I don't think you can compile batch files. One way round it would be to put the batch file and your image in a self extracting zip file. I think you can specify a file to be run after the zip has extracted.

You could also look at Autoit which is an alternative to BAT which can be compiled into an EXE.

Another option is to use either of these two to make an installer instead.

http://nsis.sourceforge.net/Main_Page

http://www.advancedinstaller.com/

Nullsoft I've never used but it's quite popular. Advanced I use quite a bit, it's very good, but I think the free version put a message in the installer saying it was made using the free version (the installs I create are usually ran silently).

EDIT: Ok you can compile a bat, http://www.abyssmedia.com/quickbfc/

EDITEDIT: I know it's probably just a wrapper, and it will still be interpreted so it isn't technically compiled.

EDITEDITEDIT: And the same goes for Autoit.
 
Last edited:
Associate
OP
Joined
31 Jan 2010
Posts
282
Location
UK
I used to use bat2com to wrap simple batch files into .com back in t'day. Not sure if that's still a valid option or not.

Think I remember that :D

Was the command something like:

Code:
bat2exe.exe test.bat test.com

Then it converted it for you?
 
Associate
OP
Joined
31 Jan 2010
Posts
282
Location
UK
Just a quick update.

I have got the batch file down to this now:

Code:
@echo off
copy OEMLogo.bmp %windir%\system32
regedit /s OEMLogo.reg

I even have the .reg file installing silently.

Just need to turn into a .exe file and I am sorted.
 
Associate
OP
Joined
31 Jan 2010
Posts
282
Location
UK
OK now I have hit a problem :(

It works fine as a batch file but when converted to a .exe file it does not work. What makes it strange is that it still comes up and says file copied but it does not actually copy the file. I have tried 2 .bat to .exe converters with the same result.

Anyone have any ideas?
 
Soldato
Joined
4 Jan 2004
Posts
7,692
Location
Nottingham
if its being run on vista and win 7 could it be something to do with admin rights?

copying files into the windows folder or program files etc i think is denied without such rights
 
Associate
OP
Joined
31 Jan 2010
Posts
282
Location
UK
I have just tried copying to the Windows Folder also the Program Files folder and this did not make a difference.

I have even tried right clicking and choosing "Run as Administrator" with no luck :(

I also have UAC disabled on my machine.
 
Back
Top Bottom