Search found 250 matches

by goodywp
15 Dec 2017 12:47
Forum: DOS Batch Forum
Topic: How to do the condition in this case...
Replies: 8
Views: 5285

Re: How to do the condition in this case...

aGerman wrote:
15 Dec 2017 12:19
Using ECHO redirection as always :wink:

Code: Select all

@echo off &setlocal EnableDelayedExpansion
set "txtfile=gen_sch_pack_need.txt"
set "outfile=vargen.txt"

set "n="
>"%outfile%" (
  for /f %%i in ('type "%txtfile%"') do (
    echo set vargen!n!=%%i
    set /a "n+=1"
  )
)
8)
by goodywp
15 Dec 2017 12:03
Forum: DOS Batch Forum
Topic: How to do the condition in this case...
Replies: 8
Views: 5285

Re: How to do the condition in this case...

Try that code @echo off &setlocal EnableDelayedExpansion set "txtfile=vargen.txt" set "n=" for /f %%i in ('type "%txtfile%"') do ( set "vargen!n!=%%i" set /a "n+=1" ) set vargen pause Steffen Thanks Steffen!! it works! How to output into a txt file?? :oops: my desired output should looks like set v...
by goodywp
14 Dec 2017 09:24
Forum: DOS Batch Forum
Topic: How to do the condition in this case...
Replies: 8
Views: 5285

Re: How to do the condition in this case...

Sorry but I also didn't understand the requirements in your other thread . Maybe you should wait for Antonio who obviously did. Steffen Thanks Steffen! I have an alternative way. Actually I have a separate txt file which only hold vargen before I combined them together say T501-08665-0102 T501-0866...
by goodywp
13 Dec 2017 15:36
Forum: DOS Batch Forum
Topic: How to do the condition in this case...
Replies: 8
Views: 5285

Re: How to do the condition in this case...

You used variable names like vargen, varsl and varfk. Are they dependent on the values? And if so, what would happen if we find a value with a middle part other than those that you wrote in your example? Steffen Yes! basically the middle part are related to profile like I posted in other post "How ...
by goodywp
13 Dec 2017 13:59
Forum: DOS Batch Forum
Topic: How to do the condition in this case...
Replies: 8
Views: 5285

How to do the condition in this case...

Hi, I have a text file, either in one line,but the string are separated by space or each line have one string.... say T501-08665-0102 T501-08665-0101 T501-08681-0100 T501-08658-0100 or T501-08665-0102 T501-08665-0101 T501-08681-0100 T501-08658-0100 Now how can I write a set command based upon the st...
by goodywp
05 Dec 2017 13:49
Forum: DOS Batch Forum
Topic: How not to hard coded in order to accommodate any number variations of the data files...
Replies: 7
Views: 4974

Re: How not to hard coded in order to accommodate any number variations of the data files...

I hope this example solves "test.bat": @echo off setlocal enableExtensions enableDelayedExpansion for /l %%n in (1, 1, 9) do ( rem create data files, or whatever you need ) :: after that just add another loop processing the needed file (loop over all values of %%n, set n to actual value, and proces...
by goodywp
05 Dec 2017 12:08
Forum: DOS Batch Forum
Topic: How not to hard coded in order to accommodate any number variations of the data files...
Replies: 7
Views: 4974

Re: How not to hard coded in order to accommodate any number variations of the data files...

It might be my fever speaking out of me, but i think you have given yourself the solution to your issues, but it seems you don't see it: data!n!.txt Just proceed with using "data!n!.txt", "data_!n!.txt", ... as you Need it in these scripts; just make sure you never overwrite the environment variabl...
by goodywp
05 Dec 2017 10:37
Forum: DOS Batch Forum
Topic: How not to hard coded in order to accommodate any number variations of the data files...
Replies: 7
Views: 4974

How not to hard coded in order to accommodate any number variations of the data files...

Hi all, Due to my limit, I had following cases which made the code as hard coded instead of open for variations. The logic is the following 1) pre-conditions: based upon the reading of a file (one script), I got some data output as data!n!.txt as below: data1.txt data2.txt data3.txt data4.txt (in th...
by goodywp
01 Dec 2017 11:09
Forum: DOS Batch Forum
Topic: What is wrong with this script?
Replies: 2
Views: 5048

What is wrong with this script?

Hi all, I have a text file called string.txt ---------------------- T501-08680-0101 T501-08815-0100 T501-08665-0102 T501-01110-0102 --------------------------- I have the following code to check if the string exist in this text file then set old_prof=xxx @echo off ::Mockup findstr /c:"T501-08680" st...
by goodywp
30 Nov 2017 09:22
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 13622

Re: How to freely select one column based on another column data?

Ohh.... but that was how it works for now. And I have no further idea...
by goodywp
30 Nov 2017 08:48
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 13622

Re: How to freely select one column based on another column data?

OK figure it out

Just remove the double-quoted around

set prof=QA_Infra

and it works fine now.

Thanks again!

goodywp
by goodywp
30 Nov 2017 08:38
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 13622

Re: How to freely select one column based on another column data?

Hi Aacini,

Thanks for the code. I tried but complain this:
delims=, " was unexpected at this time.

Any reasons?

Thanks
by goodywp
29 Nov 2017 15:49
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 13622

How to freely select one column based on another column data?

Hi All, I have a following code to do the job as select from any other column data based upon first column data via a criteria (profile as which column): call C:\auto_pkg_build\Scripts\scheme_replace\get_src.cmd set prof=%prof: =% if "%prof%"=="QA_Infra" goto QA_Infra if "%prof%"=="NAR_Infra" goto N...
by goodywp
29 Nov 2017 15:28
Forum: DOS Batch Forum
Topic: How to set up root directory ?
Replies: 9
Views: 6120

Re: How to set up root directory ?

Thanks Squashman!!
I had many commands using the root directory. For now, they can compromise my structure. Maybe later as enhancement....

Thanks

goodywp
by goodywp
28 Nov 2017 14:55
Forum: DOS Batch Forum
Topic: How to set up root directory ?
Replies: 9
Views: 6120

Re: How to set up root directory ?

Hi Steffen, Thanks a lot! I tried a test using your suggested and the test.cmd is currently in C:\auto_pkg_build\Scripts\scheme_replace\ Here is the code for test.cmd echo "%~dp0.." echo "%~dp0..\.." echo "%~dp0..\..\Sources" echo "%~dp0..\..\Sources\Source_pkg" here what I got: "C:\auto_pkg_build\S...