Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Batch file closes before end


  • Please log in to reply
3 replies to this topic

#1 CHansohn

CHansohn

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Minnesota
  • Local time:12:53 AM

Posted 25 June 2010 - 04:00 PM

I'm writing a batch file to try and make the steps for making a winpe boot disk easier. the problem I have is it gets through some of the commands then it closes and doesn't finish. heres what I got so far:

@echo off
echo Updating path to include dism, oscdimg, imagex
echo.
echo %~dp0

if /i %PROCESSOR_ARCHITECTURE% EQU X86 echo %~dp0..\%PROCESSOR_ARCHITECTURE%
if /i %PROCESSOR_ARCHITECTURE% NEQ X86 echo %~dp0..\%PROCESSOR_ARCHITECTURE%;%~dp0..\x86

if /i %PROCESSOR_ARCHITECTURE% EQU X86 echo %~dp0..\%PROCESSOR_ARCHITECTURE%\Servicing;
if /i %PROCESSOR_ARCHITECTURE% NEQ X86 echo %~dp0..\%PROCESSOR_ARCHITECTURE%\Servicing;%~dp0..

\x86\Servicing;

echo.

if /i %PROCESSOR_ARCHITECTURE% EQU X86 set PATH=%~dp0;%~dp0..\%PROCESSOR_ARCHITECTURE%;%~dp0..\

%PROCESSOR_ARCHITECTURE%\Servicing;%PATH%;
if /i %PROCESSOR_ARCHITECTURE% NEQ X86 set PATH=%~dp0;%~dp0..\%PROCESSOR_ARCHITECTURE%;%~dp0..\x86;

%~dp0..\%PROCESSOR_ARCHITECTURE%\Servicing;%~dp0..\x86\Servicing;%PATH%;
cd /d %~dp0
cd c:\program files\windows aik\tools\petools
DISM /Cleanup-wim

SET /P TYPE=What kind of winpe disk do you wish to make (x86, amd64)?

Copype.cmd %TYPE% C:\winpe_%TYPE%
copy c:\winpe_%TYPE%\winpe.wim c:\winpe_%TYPE%\ISO\sources\boot.wim

DISM /mount-wim /wimfile:C:\winpe_%TYPE%\winpe.wim /index:1 /mountdir:C:\winpe_%TYPE%\mount
DISM /image:C:\winpe_%TYPE%\mount /add-package /packagepath:"C:\Program files\windows aik\tools

\petools\%TYPE%\winpe_FPs\winpe-wim.cab"
DISM /image:C:\winpe_%TYPE%\mount /add-package /packagepath:"C:\Program files\windows aik\tools

\petools\%TYPE%\winpe_FPs\en-us\winpe-wim_en-us.cab"

echo Any packages like imagex, gimagex, ghost, ect copy them to "C:\winpe_%TYPE%\mount\windows

\system32" folder now!
pause

DISM /unmount-wim /mountdir:C:\winpe_%TYPE%\mount /commit
copy c:\winpe_%TYPE%\winpe.wim c:\winpe_%TYPE%\iso\sources\boot.wim /y

SET /P ANSWER=Do you wish to make an ISO file (y/n)?

if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)

:yes
oscdimg -n -bc:\winpe_%TYPE%\etfsboot.com c:\winpe_%TYPE%\iso c:\winpe_%TYPE%\winpe_%TYPE%.iso
exit

:no
exit


the part that's bold is the last command it executes before closing. what am I doing wrong?

CPU = Intel i7 950
Motherboard = Asus P6X58D
RAM = Corsair XMS3 DDR3 6X 2GB
Power Supply = Corsair AX1200W
Graphics Card = GTX 580 2-way SLI


BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:10:53 PM

Posted 25 June 2010 - 08:22 PM

Where is Copype.cmd? That file contains what's causing the exit.
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 strolln

strolln

  • Members
  • 400 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:N. Calif.
  • Local time:09:53 PM

Posted 25 June 2010 - 08:45 PM

You need to use the CALL command to call copype.cmd, then execution will be returned to the caller after copype.cmd finishes. If you just execute copype.cmd as you have done then things will stop after copype.cmd finishes.
To Err is human; to really foul things up requires a Bleeping Computer!

#4 CHansohn

CHansohn
  • Topic Starter

  • Members
  • 188 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Minnesota
  • Local time:12:53 AM

Posted 25 June 2010 - 10:30 PM

Thanks Strolln that was just what I needed.

CPU = Intel i7 950
Motherboard = Asus P6X58D
RAM = Corsair XMS3 DDR3 6X 2GB
Power Supply = Corsair AX1200W
Graphics Card = GTX 580 2-way SLI





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users