1.

Solve : put limitation for avoid accessing to some steps?

Answer»

hi
i have a batch  file with  some comments and steps it seems something like this

Quote

echo off
setLocal EnableDelayedExpansion

:step1
.....
some comments

:step2
.....
some comments

:setp3
.....
some comments

:step4
.....
some comments

:end

but  i need to put some limitation  in some of steps in following way
i  want if  some files has found (php,ini,txt ) just step  1and 3 should be accessible and then  go to  end but if (xml,dll,exe)files has found all  steps should be accessible
is there any idea?


sorry  guys : if it's  possible  read  my  next  post  in  this  topic  to  find  out  more  information
C:\>type  findfiles.bat
Code: [Select]echo off
setLocal EnableDelayedExpansion

echo.  >  txtphpini.txt

dir /s /b  *.txt *.php  *.ini  >>  txtphpini.txt



echo. >  xmldllxe.txt

dir /s /b  *.xml  *.dll *.exe  >>  xmldllxe.txtC:\> findfiles.bat Quote from: billrich on June 19, 2009, 02:55:58 PM
C:\>type  findfiles.bat
Code: [Select]echo off
setLocal EnableDelayedExpansion

echo.  >  txtphpini.txt

dir /s /b  *.txt *.php  *.ini  >>  txtphpini.txt



echo. >  xmldllxe.txt

dir /s /b  *.xml  *.dll *.exe  >>  xmldllxe.txtC:\> findfiles.bat
That might not exactly help the OP out, depending on their knowledge level...

But in conjunction with your SCRIPT,

echo off
for /f "delims=" %%A in ('type txtphpini.txt') do (
REM YOUR COMMANDS HERE
REM USE %%A AS A FILE NAME
REM DON'T REMOVE THE BRACKETS
REM THIS DOES NOT NEED TO BE REMOVED
)
for /f "delims=" %%B in ('type xmldllxe.txt') do (
REM YOUR COMMANDS HERE
REM USE %%B AS A FILE NAME
REM DON'T REMOVE THE BRACKETS!
REM THIS DOES NOT NEED TO BE REMOVED
)
Will work just fine. Insert the commands for the txt, php & ini files, then copy those commands to the xml, dll & exe section, then add the xml, dll & exe only commands too.Helpme,

With all due respect, Your code is much more difficult for mioo_sara
 to understand than my code.

By the way, my code created  the "xmldllxe.txt"  file and the txtphpini.txt file .  Mioo_sara,
the original poster, offered no file names.


Quote from: Helpmeh on June 19, 2009, 04:54:59 PM


echo off
for /f "delims=" %%A in ('type txtphpini.txt') do (
REM YOUR COMMANDS HERE
REM USE %%A AS A FILE NAME
REM DON'T REMOVE THE BRACKETS
REM THIS DOES NOT NEED TO BE REMOVED
)
for /f "delims=" %%B in ('type xmldllxe.txt') do (
REM YOUR COMMANDS HERE
REM USE %%B AS A FILE NAME
REM DON'T REMOVE THE BRACKETS!
REM THIS DOES NOT NEED TO BE REMOVED
)
Will work just fine. Insert the commands for the txt, php & ini files, then copy those commands to the xml, dll & exe section, then add the xml, dll & exe only commands too.
Quote from: billrich on June 19, 2009, 05:09:36 PM
Helpme,

With all due respect, Your code is much more difficult for mioo_sara
 to understand than my code.

By the way, my code created  the "xmldllxe.txt"  file.  Mioo_sara,
 original poster, offered no file names.


I'm not saying my code is better or easier than your code. I'm saying that in combonation with both of our codes, the OP can actually use the directory your code makes to do work.

For example, if txtphpini.txt contained this:
C:\Test\test.txt
C:\Blah\test.php
C:\NONE\test.ini

then this code could delete them.
for /f "delims=" %%A in ('type txtphpini.txt') do (
del %%A
)

This reminds me of what my scout leader used to say..."Apart, you can't do anything usefull with those talents, but together you can do anything!"Helpme,

Yes, two heads working on a problem usually find a solution quicker.

But,  I don't understand what Mioo_sara is after.  Mioo_sara  needs to find files with certain EXTENTIONS: exe, ini . . . .  Many of the files are important system files and surely Mioo_sara's goal is not to delete system files or to move system files from their original FOLDER?

We  really don't have enough information to define the problem.

My code did not create any new directories (folders ).  My code created two new files and placed the files in the root ( C:\ ) directory. Quote from: billrich on June 19, 2009, 05:37:25 PM
Helpme,

Yes, two heads working on a problem usually find a solution quicker.

But,  I don't understand what Mioo_sara is after.  Mioo_sara  needs to find files with certain extentions: exe, ini . . . .  Many of the files are important system files and surely Mioo_sara's goal is not to delete system files or to move system files from their original folder?

We  really don't have enough information to define the problem.
Billrich,

Here's what I can see the OP wants:
The OP has a set of commands, some of which should only be run on txt, php or ini files, and all of them run on xml, dll or exe files.

Here's what I can see you've done:
Created a batch script that CREATES a directory of all the txt, php and ini files in one text document, and xml, dll and exe files in another.

Here's what I can see I've done:
Used the two directory files in for loops so multiple commands can be performed on each file automatically.

Here's what I see we've done together:
Completed what the OP wants.i'm  back  again
thanks dear (billrich and Helpmeh) for your replies and your scripts

Quote
Here's what I can see the OP wants:
The OP has a set of commands, some of which should only be run on txt, php or ini files, and all of them run on xml, dll or exe files.

yes helpmeh you got me !  this is what exactly  i need but  i think you and billrich  just focus on  files and not commands and steps
in  my  real  program  there is  more  than  100 lines  of codes  and there  is  lots  of  for  example  %%A so  i  think  i  should  put  my  pressure  on  something  more  unique
attention=
1- in  real  program  there  is  more  than  15  step  that  contain different  commands
2- files  should  not  follow  all commands and  steps  (one  by  one ) so  ....
3-as you  can  see in  next example some commands are  in  separated steps and  they  are acondylose
3- in below example  for  (php,ini,txt ) files ,  they  should  go  through  lots  of  commands  not  just  1 and  2
example= for (php,ini,txt ) files 

these are the steps that (php,ini,txt )files should go through
Quote
:step1
(sort by  alphabet) command

:step2
(copy  to...files)command

:STEP7
(search  to  find duplicate  files)command

:step 11
email me file names (command)

:end

it is  more  similar  to  what  i want
====================================================
Mioo_sara,

Please post your one hundred lines of code.


C:\>sort txtphpini.txt  |  More

C:\1100\SETUP.INI
C:\a-hire.txt
C:\aaa.txt
C:\bat.txt
C:\batextra\bill72.txt
C:\batextra\caavsetupLog.txt
C:\batextra\caisslog.txt
C:\batextra\christmas.txt
C:\batextra\count.txt
C:\batextra\data06.txt
C:\batextra\date.txt
C:\batextra\db.txt
C:\batextra\disklog.txt
C:\batextra\file.txt
C:\batextra\for.txt
C:\batextra\hist.txt
C:\batextra\homewk.txt
C:\batextra\Instruct_for.txt
C:\batextra\list_of_program_files.txt
C:\batextra\listone.txt
C:\batextra\log.txt
C:\batextra\noperiod.txt
C:\batextra\outmenu.txt
C:\batextra\period.txt
C:\batextra\pipe.txt
C:\batextra\session.txt
C:\batextra\show.txt
C:\batextra\signal.txt
C:\batextra\str3.txt
C:\batextra\task.txt
C:\batextra\temp1.txt
C:\batextra\test07.txt
C:\batextra\testfilnam.txt
C:\batextra\tips.txt
C:\batextra\win.ini
C:\batextra\x.txt
C:\batextra\xmas.txt
C:\batextra\xxx.txt
thanks billrich
well  i created a program  with  adobe flash  for  my  weblog
inside there is lots  of codes(action  scripts codes) but  because flash  can  not  work with  outside world easily !! i have to  use third party  tools  . so  i  choosed batch  codes because  they  are  easy  to  understand  and  easy  to  work  with
now  i  have  more than 20 bat file (i  put all of  them inside of  my  program  and  with  pressing each  button  when  we need  they  create  in  temp  folder  and  get start) but  problem  is  here  that  i want  to  put  all  these  batch  codes  in  a single  bat file and  call  every  command  from  inside  of  it
i dont  know  if it's  possible  or  what?  well  if  i put  each  particular  code  in  a  separate  bat file they will  work  very  nice  but  is  there  any  possibility  to  start  a batch  file  and  call  commands  from  inside  of  batch  file  when  we  need  it?
Mioo_sara,

Where is the code?  Post the code.

You may put all the code in one batch file.

or

You may call each of the batch files from one central batch file.

Where is  the code?  Post the code.

ok  i  will put  all  codes  in  a  batch  file  and  send  it  to  you


Discussion

No Comment Found