IPB

Google Frontpage Forums Unattended CD/DVD Guide
 
Reply to this topicStart new topic
> Automatic editing of a batch file?, Using PowerShell
Archigos
post May 22 2008, 12:08 AM
Post #1


Newbie


Group: Members
Posts: 17
Joined: 16-June 04
From: Upstate New York
Member No.: 22763
OS: Vista Ultimate x86
Country Flag


I use a lot of SVN directories for a project and thankfully each one has it's own "build.bat". What I'm trying to do is find a way to automate calling a bunch of these. The problem I'm coming across is that they each have a "pause" at the end of the file so you can view errors before it closes. I wrote up my own batch files that handles running all the needed batches and moving the results where they need to be, but I keep forgetting to sit around and watch it, so half the time I come back and it's sitting on like the second or third one waiting for me to hit a key, then I have to wait longer since it needed the input.

I know enough about PowerShell to get around with the variables and the basics, but I figured using that would give me more control of the resulting files. So what I want to accomplish is making a copy of the build.bat (in case it's updated it doesn't get broke) that is missing the pause at the end of the file.

The part I need help with is either the ability to remove all the pause commands from the runme.bat (copy of build.bat) or a way to inject all the information from build.bat (minus the pause commands) into a runme.bat.

Any help would be greatly appreciated.
Go to the top of the page
 
+Quote Post
Yzöwl
post May 22 2008, 10:30 AM
Post #2


MSFN Master
Group Icon

Group: Super Moderator
Posts: 2751
Joined: 13-October 04
Member No.: 33618
OS: none
Country Flag


We're going to need a lot more information, the layout, (and probably content due to poison characters), of the build.bat files for a start!
Go to the top of the page
 
+Quote Post
Archigos
post May 22 2008, 03:51 PM
Post #3


Newbie


Group: Members
Posts: 17
Joined: 16-June 04
From: Upstate New York
Member No.: 22763
OS: Vista Ultimate x86
Country Flag


The main layout is this:

CODE
X:\
  \BatchFiles  (Where I'm running the PowerShell and batch scripts)
  \Build         (Where all the finished stuff goes)
  \SVN
      \Project
           \1
           \2
           \etc

The individual Build.bat's are in the directories 1,2,etc... (I think there's like 12 total)

Not exactly sure what you mean by poison characters, but the batch files mainly just move crap around and remove the .svn directories... they also call an internal image compressor. I guess if I had to I could just move the crap around via the main PS script instead of calling all the build.bat's but I wanted to do it that way in case they change something on me.
Go to the top of the page
 
+Quote Post
Yzöwl
post May 22 2008, 10:13 PM
Post #4


MSFN Master
Group Icon

Group: Super Moderator
Posts: 2751
Joined: 13-October 04
Member No.: 33618
OS: none
Country Flag


If you're wanting a dynamic 'copy without pause' whatever performs that task needs to be able to read and write a file containing characters which would be problematic to reproduce due to them having special meanings.

What would be needed therefore is one or more example build.bat files in order to choose an appropriate method, tool or language for performing the task.
Go to the top of the page
 
+Quote Post
Archigos
post May 22 2008, 11:16 PM
Post #5


Newbie


Group: Members
Posts: 17
Joined: 16-June 04
From: Upstate New York
Member No.: 22763
OS: Vista Ultimate x86
Country Flag


Most of the build.bat's follow roughly this idea...

CODE
@ECHO OFF

ECHO ------------------------------
ECHO Creating Build Folder
rmdir BUILD /S /Q
md BUILD

ECHO ------------------------------
ECHO Building Directory...
xcopy "a" "BUILD\test4\a" /E /Q /I /Y
xcopy "b" "BUILD\test4\b" /E /Q /I /Y
xcopy "c" "BUILD\test4\c" /E /Q /I /Y
xcopy "d" "BUILD\test4\d" /E /Q /I /Y
xcopy "*.xml" "BUILD\test4\" /Q /I /Y
xcopy "*.txt" "BUILD" /Q /I /Y

ECHO ------------------------------
ECHO Removing SVN directories from build...
FOR /R BUILD %%d IN (SVN) DO @RD /S /Q "%%d" 2>NUL

ECHO Build Complete - Scroll Up to check for errors.
ECHO Final build is located in the BUILD directory
ECHO Enjoy!!!

pause


Hope that helps
Go to the top of the page
 
+Quote Post

Google Frontpage Forums Unattended CD/DVD Guide

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 9th January 2009 - 04:02 PM
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001-2008 msfn.org
Privacy Policy