Solved cake bake with bacth file scripting

July 13, 2012 at 10:32:07
Specs: Windows XP
hi there..
I need help to create batch scripting with a file.txt to execute my command from each line in my file.
cakephp need to bake each table and I usually use manual input to process many model/controller/view to bake with console in command prompt.

eg :
C:\...>cake bake model TableName1
C:\...>y
C:\...>cake bake controller TableName1 public
C:\...>y
C:\...>cake bake view TableName1
C:\...>y

to bake other table I just change TableName1 to next TableName2

and repeat it until 10-30 table :D

is there any trick to process in command prompt if I have a file.txt with contents below and process them line by line?

file.txt
------------------------------------------------------------
cake bake model TableName1
y
cake bake controller TableName1 public
y
cake bake view TableName1
y
cake bake model TableName2
y
cake bake controller TableName2 public
y
cake bake view TableName2
y
-------------------------------------------------------


really appreciate for helping me out

thanks


See More: cake bake with bacth file scripting

Report •


#1
July 13, 2012 at 18:34:38
i'm guessing the "y" is a response to a prompt? maybe like this (save as batchfile, not txt, f/e: kake.bat
for /L %%a in (1,1,30) do (
echo y | cake bake model table%%a
echo y | cake bake controller table%%a
echo y | cake bake view table%%a
)
:end
not tested

Report •

#2
July 15, 2012 at 09:29:16
yes "y" is performing respons to answer "yes"
your script work.
sorry, I mean the TableName not increase from 1 to 30, but the TableName name will be:
-companies
-clients
-users
-logs
-etc..


please help if there any solution..
thanks


Report •

#3
July 15, 2012 at 15:21:46
✔ Best Answer
just need a source of the table's names, from either a directory or a text file.
f/e: if these files all are in one directory, of if they all start with "-", do like:
for %%a in (-*.) do (
echo y | cake bake model table%%a
echo y | cake bake controller table%%a
echo y | cake bake view table%%a
)
:end version1
or:
dir /b -*.>tempfile
for /f %%a in (tempfile) do ((same stuff))

Report •

Related Solutions


Ask Question