MSFN Forum: little batch file help pls - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

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

little batch file help pls Rate Topic: -----

#1 User is offline   `Felix` 

  • MSFN Contributor
  • PipPipPip
  • Group: Members
  • Posts: 481
  • Joined: 28-July 04

Posted 15 December 2005 - 01:49 AM

Hi there,

I would like a little bit of help putting together a smarter batch file that i can reuse...

Currently i am basically doing this on my application CD's

cd dir1\
start /wait doIT.exe (do it my custom installer that i have put together for each of my applications to silently install and configure. i.e. add reg settings etc.)
cd ..
cd dir2\
start /wait doIT.exe
cd ..
cd dir3\
start /wait doIT.exe
and so on...

I thought it would be good/cleaner to do something like

for %%i in (dir) do if exist %%i\doIT.exe
the code to run...

I know the code above is not correct - but this will give you the idea of what i am seeking... i would appreciate any help/advice you can offer....


#2 User is offline   Yzöwl 

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

Posted 15 December 2005 - 03:34 AM

Try something like this
for /f "delims=" %%? in ('dir/b/s/a-d "doIT.exe" ^2^>nul') do if errorlevel 0 start "" /w "%%~f?"
or
for /r %%? in ('dir/b/a-d "doIT.exe" ^2^>nul') do if errorlevel 0 start "" /w "%%~f?"

This post has been edited by Yzöwl: 15 December 2005 - 06:10 AM


#3 User is offline   `Felix` 

  • MSFN Contributor
  • PipPipPip
  • Group: Members
  • Posts: 481
  • Joined: 28-July 04

Posted 15 December 2005 - 03:43 AM

View PostYzöwl, on Dec 15 2005, 05:34 PM, said:

Try something like this
for /f "delims=" %%? in ('dir/b/s/a-d "doIT.exe" ^2^>nul') do if errorlevel 0 start "" /w "%%~f?"
or
for /r %%? in ('dir/b/s/a-d "doIT.exe" ^2^>nul') do if errorlevel 0 start "" /w "%%~f?"


No joy :( but thankyou for your suggestions... :thumbup

#4 User is offline   nakira 

  • Member
  • PipPip
  • Group: Members
  • Posts: 118
  • Joined: 18-July 04

Posted 15 December 2005 - 05:00 AM

Try this
for /d %%a in (*) do if exist %%a\Doit.exe start /wait %%a\doit.exe


#5 User is offline   Yzöwl 

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

Posted 15 December 2005 - 07:33 AM

in each of the examples I gave, you would of course need to be at least in the root of the CD

e.g.
 
@echo off&setlocal enableextensions
for /f "usebackq skip=1" %%? in (`wmic cdrom where "MediaLoaded='TRUE'" get drive ^2^>nul`) do if errorlevel 0 set CDROM=%%?
if not defined CDROM endlocal&goto :eof
pushd %CDROM%
for /f "delims=" %%? in ('dir/b/s/a-d "doIT.exe" ^2^>nul') do if errorlevel 0 call :RunIt "%%~f?"
popd&endlocal&goto :eof
:RunIt
start "" /w %1
goto :eof 

another method too
for /f "delims=" %%? in ('dir/b/ad') do (
  if exist "%%?\doIT.exe" (
	pushd %%?
	start "" /w doIT.exe
	popd
	)
  )

This post has been edited by Yzöwl: 15 December 2005 - 08:08 AM


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