Jump to content

DOS errors on a simple batch file


Recommended Posts

Not too sure where to post this, but these forums are always such a huge help.

I created a simple batch file to run some commands and copy files, and it works great. The folder

contains all the files and no matter where I put the folder, the batch file works.

So I thought it would be even better if it was packaged as an EXE, I used Iexpress on WindowsXP. Iexpress unpackages everything to a temp folder, then runs my setup.bat file. The first few commands that worked before it was packaged were Title, Color, an IF statement and a SET statement. When you double click the package the files expand (echo is on and there are lots of pauses). If, color and title are bad command or file name and the set error is out of environment space. I would think it has to be DOS related since the batch file can no longer run the If command, it doesnt' know where to find that internal command. Any ideas?

Thanks a bunch!

Link to comment
Share on other sites


As far as i know, you can't run a cmd file with Iexpress, which is why it's a bat. Pardon the code as i'm no programmer. It started as a simple zipped up file because I don't always have my laptop, and if I was on site someplace and needed to ghost a machine, here was a quick way to get a ghost cast server up and running. It just copies the ghost files, and the DOS nic drivers we use, so I can run ghostcast from any pc, and create a boot floppy. I thought throwing it all into an EXE would make life easy, but it's just personal now...i have to get it running.

This is the start of my setup.bat file

rem @echo off

cmd /C title My Ghostcast setup

color 71

pause

if not exist "C:\Documents and Settings\All Users\Application Data\Symantec\Ghost\Template" mkdir "C:\Documents and Settings\All Users\Application Data\Symantec\Ghost\Template"

set ghostall=C:\Documents and Settings\All Users\Application Data\Symantec\Ghost\Template

ECHO.

ECHO . Expanding files

echo %ghostall%

echo This should have echoed ghostall

pause

7za e -o"%ghostall%" -y .\DOSNIC.7z

if not exist "C:\Program Files\Symantec\Ghost" mkdir "C:\Program Files\Symantec\Ghost"

ECHO.

ECHO . Setting up and sharing the Ghost directory if it's not already

ECHO.

pause

net share Ghost="C:\Program Files\Symantec\Ghost"

ECHO . Copying files

ECHO.

set ghostprog=C:\Program Files\Symantec\Ghost

echo %ghostprog%

echo This should have echoed ghostprog

pause

xcopy .\gdisk.exe "%ghostprog%"

xcopy .\gdisk32.exe "%ghostprog%"

xcopy .\"ghost boot wizard.exe" "%ghostprog%"

xcopy .\"Ghost Boot Wizard.lnk" "%ALLUSERSPROFILE%\desktop" /y /q /c

xcopy .\ghost32.exe "%ghostprog%"

xcopy .\ghost.exe "%ghostprog%"

I have no issues when I run setup.bat. It's only after it's packages with Iexpress.

I start by creating a new package in Iexpress and including all of the necesary files in one folder. On the Install Program to Launch screen I select setup.bat. Everything packages fine. When I run the EXE it expands everything but when it hits the Color command I get a bad command or file name. The same is true of the first IF statement...and so on..

Thank you.

Link to comment
Share on other sites

As I play around with this some more and still not getting anywhere, let me just ask this instead. When I run Setup.bat it changes the color because of the color 71 command on the third line.

Why would I get a bad command or file name error when it's packaged as an EXE. Obviously it can't find color, whether it's an internal or external command. My question is why?

Link to comment
Share on other sites

Nope, that's not it, heck, that's the only part that works right. I end up with a title to my batch file where all the commands run.

Try this, create test.bat with this code:

@echo off

title Test

color 71

pause

Run it and you get a Dos box titled Test, with a grey background and blue lettering.

Now open Iexpress, create a new directive file, purpose=extract files and run installation program, set the install program to Test.bat you just created and watch what happens. You'll get 2 bad command or file name errors then it pauses...it's a dos environment issue of some sort that's driving me nuts!

If I use Winzip self extractor to create the EXE it works great. So I'm at a loss as to why Iexpress is failing.

Link to comment
Share on other sites

As far as i know, you can't run a cmd file with Iexpress, which is why it's a bat.

Of course IExpress will run a cmd file!

Nope, that's not it, heck, that's the only part that works right.

That wasn't a fix for all your problems, I'm telling you that you don't need the cmd /c in order to run title. All you need is what you've used in the example you've provided above.

Attached is a zipped archive containing a CMD file and its associated SED file, place them both in the root of your C: drive, run it through your IExpress wizard, create the EXE and run it!

Also if you want to edit the SED file change the two instances using CMD file extensions to BAT and rename your CMD script to BAT, you'll probably find it doesn't work when run!

MyTest.zip

Link to comment
Share on other sites

One quick question....how did you get Iexpress to see a cmd file?

When i add a cmd file to "Packaged Files" then Next to "Install Program to Launch" I don't see any cmd files listed.

What I just tried though, thanks to your guidance, I took my non working SED and edited it, changing AppLaunched= to the cmd file instead of tha bat (i just renamed my bat to cmd) and in one quick test it worked. Is that how you did it?

Link to comment
Share on other sites

No, on this occasion I chose it directly through the GUI Wizard interface, sometimes it appears in the drop down list, sometimes it doesn't.

My usual method, when I used to use this tool, was to modify an existing SED file however.

Link to comment
Share on other sites

Sometimes it's there, sometimes not. Well isn't that just great for someone like me who's never used it before and is expecting it to just work??? Hahahaha.

Oh well, now I know. THANK YOU so much! It was holding me back on a few things.

Will

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...