MSFN Forum: DOS errors on a simple batch file - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DOS errors on a simple batch file packaged with Iexpress... Rate Topic: -----

#1 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

  Posted 18 February 2008 - 11:53 AM

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!


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,117
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 18 February 2008 - 01:37 PM

How about providing us with the bat file, (which should incidentally be a cmd file in an NT OS), and an idea of the process you went through in order to create the executable.

#3 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 18 February 2008 - 03:07 PM

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.

#4 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 18 February 2008 - 03:59 PM

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?

#5 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,117
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 18 February 2008 - 05:06 PM

Your second line opens up an instance of cmd.exe with a `My Ghostcast setup` in the TITLE bar and immediately closes due to the /C switch.

#6 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 18 February 2008 - 05:22 PM

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.

#7 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 18 February 2008 - 10:21 PM

I added the SET command:

@echo off
title Test
color 71
set
pause

The output of set is from command.com, not cmd.exe! And a lot of the variables are truncated to 8.3 format.

Getting somewhere...

#8 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,117
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 19 February 2008 - 03:58 AM

View Postmeister, on Feb 18 2008, 09:07 PM, said:

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!

View Postmeister, on Feb 18 2008, 11:22 PM, said:

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!

Attached File(s)



#9 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 19 February 2008 - 09:49 AM

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?

#10 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,117
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 19 February 2008 - 10:33 AM

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.

#11 User is offline   meister 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 20-August 07

Posted 19 February 2008 - 10:52 AM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy