Search found 250 matches

by goodywp
26 Jan 2018 15:46
Forum: DOS Batch Forum
Topic: what is the easiest way to trim off double quote of each line in a txt file
Replies: 11
Views: 7634

Re: what is the easiest way to trim off double quote of each line in a txt file

ShadowThief wrote:
23 Jan 2018 20:24
goodywp wrote:
23 Jan 2018 13:02
aGerman wrote:
23 Jan 2018 12:54
Did you read my comments and did you understand what I wrote? What did you try?
add delayed expansion in a parenthesized block
Cool, now try doing it correctly.
Thank you!
by goodywp
26 Jan 2018 15:45
Forum: DOS Batch Forum
Topic: how to read from a txt file and process then write into a txt file
Replies: 4
Views: 3717

how to read from a txt file and process then write into a txt file

Hi
I have a txt file usually with 3 lines, either line 2 or line 3 could show "ECHO is off." like below:

T501-08680-0102
ECHO is off.
ECHO is off.

I would like to have a output txt file showing as below:

T501-08680-0102
no_sl
no_fk

Thanks
by goodywp
23 Jan 2018 13:02
Forum: DOS Batch Forum
Topic: what is the easiest way to trim off double quote of each line in a txt file
Replies: 11
Views: 7634

Re: what is the easiest way to trim off double quote of each line in a txt file

aGerman wrote:
23 Jan 2018 12:54
Did you read my comments and did you understand what I wrote? What did you try?
add delayed expansion in a parenthesized block
by goodywp
23 Jan 2018 12:37
Forum: DOS Batch Forum
Topic: what is the easiest way to trim off double quote of each line in a txt file
Replies: 11
Views: 7634

Re: what is the easiest way to trim off double quote of each line in a txt file

What the heck are you doing? What is the reason for saving the line into a variable before you try to echo it? And if you try to do so why didn't you use delayed expansion in a parenthesized block? Steffen tried and got ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. E...
by goodywp
23 Jan 2018 10:06
Forum: DOS Batch Forum
Topic: what is the easiest way to trim off double quote of each line in a txt file
Replies: 11
Views: 7634

Re: what is the easiest way to trim off double quote of each line in a txt file

Did you read the help file for the FOR command. In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive l...
by goodywp
22 Jan 2018 13:46
Forum: DOS Batch Forum
Topic: what is the easiest way to trim off double quote of each line in a txt file
Replies: 11
Views: 7634

what is the easiest way to trim off double quote of each line in a txt file

Hi I have a txt file like this: "abcdef/edc/ec/c/" "abec/sdlkd/dlkdk/" ................ What is the easiest way to trim off the double quote in each line in this txt file.. abcdef/edc/ec/c/ abec/sdlkd/dlkdk/ I tried this way and still got the quote... @echo off If exist schpacklist.txt (del schpackl...
by goodywp
15 Jan 2018 09:06
Forum: DOS Batch Forum
Topic: setlocal enabledelayedexpansion and its potential effect?
Replies: 6
Views: 6930

Re: setlocal enabledelayedexpansion and its potential effect?

jeb wrote:
12 Jan 2018 00:04
You have to CALL your script.
Without CALL the batch context ends and the command line context is enabled.

Code: Select all

Call C:\auto_pkg_build\...
Thanks jeb!!
You are right !! My bad.... after adding call, the problem is solved....

:oops:
by goodywp
11 Jan 2018 19:02
Forum: DOS Batch Forum
Topic: setlocal enabledelayedexpansion and its potential effect?
Replies: 6
Views: 6930

Re: setlocal enabledelayedexpansion and its potential effect?

pieh-ejdsch wrote:
11 Jan 2018 16:22
is an echo switched on in one of your scripts?
Just check it out with a script.
-----
checkcmd.cmd Yourbatch.cmd echo
No! nothing changed... only added two scripts at the end of that loop....
by goodywp
10 Jan 2018 10:06
Forum: DOS Batch Forum
Topic: setlocal enabledelayedexpansion and its potential effect?
Replies: 6
Views: 6930

setlocal enabledelayedexpansion and its potential effect?

Hi All, I just got an issue which could be related to "setlocal enabledelayedexpansion" Please correct me if I am wrong... I have the following code: @ECHO OFF if exist C:\auto_pkg_build\Tools\PACKAGER\extract_scheme.log (del C:\auto_pkg_build\Tools\PACKAGER\extract_scheme.log) if exist C:\auto_pkg_...
by goodywp
09 Jan 2018 16:13
Forum: DOS Batch Forum
Topic: How to chop off substrings in the txt file
Replies: 6
Views: 4461

Re: How to chop off substrings in the txt file

Missing the IN . Thanks for your reminding and works.... BTW, I used the memory line you mentioned and modified code to be like this @echo off call C:\auto_pkg_build\Scripts\scheme_replace\varconfig.cmd set VAR14=%VAR14:~8% cd "C:\auto_pkg_build\Tools\PACKAGER\S3S\TELIUM3\%VAR14%" if exist trim_gen...
by goodywp
09 Jan 2018 15:08
Forum: DOS Batch Forum
Topic: How to chop off substrings in the txt file
Replies: 6
Views: 4461

Re: How to chop off substrings in the txt file

Untested: setlocal EnableDelayedExpansion >"another.txt" ( for /f "usebackq delims=" %%i ("original.txt") do ( set "n=%%~ni" echo !n:~,6!*%%~xi ) ) endlocal Steffen Thanks Steffen! I use this code: @echo off call C:\auto_pkg_build\Scripts\scheme_replace\varconfig.cmd set VAR14=%VAR14:~8% cd "C:\aut...
by goodywp
09 Jan 2018 14:26
Forum: DOS Batch Forum
Topic: How to chop off substrings in the txt file
Replies: 6
Views: 4461

How to chop off substrings in the txt file

Hi All, Happy New Year to you all!!! It is a great forum here in which I can have your help.... I have a txt file showing like this: 500006011000.S3S 500007011000.S3S 500008011000.S3S 500009011000.S3S 500010011000.S3S 500012011000.S3S 500014011000.S3S 500016011000.S3S 500134010100.S3S 500028011201.S...
by goodywp
09 Jan 2018 14:20
Forum: DOS Batch Forum
Topic: How to lift up this limitation...
Replies: 4
Views: 4888

Re: How to lift up this limitation...

This an oldie but goodie: Rem Posted: Sun Jan 22, 2012 9:02 pm by dbenham Rem Post subject: Re: foolproof counting of arguments Rem Start http://www.dostips.com/forum/viewtopic.php?p=13002#p13002 I chopped this from one of my scripts as an example: @Echo Off&SetLOCAL EnableDelayedExpansion &Rem.and...
by goodywp
20 Dec 2017 08:41
Forum: DOS Batch Forum
Topic: How to lift up this limitation...
Replies: 4
Views: 4888

Re: How to lift up this limitation...

Correct. You only have 1 to 9 for arguments. You can still send more than 9 arguments, you just need to use the SHIFT command to access them. Two options for you. @echo off for /f "tokens=1-11 delims=," %%A in (pkg_data.txt) do ( call :EachLine "%%~A" "%%~B" "%%~C" "%%~D" "%%~E" "%%~F" "%%~G" "%%~H...
by goodywp
19 Dec 2017 16:18
Forum: DOS Batch Forum
Topic: How to lift up this limitation...
Replies: 4
Views: 4888

How to lift up this limitation...

Hi, I have a data file as pkg_data.txt NAR_Infra, T592,08693,-0101,T500,Tetra_TD_Desk5000,8295010512_TSA.P3A ,TELIUM3\TSA ,T501-08665-0102,T501-08681-0100,no_fk Now I have this script as below: @echo off for /f "tokens=1-12 delims=," %%A in (pkg_data.txt) do call :EachLine %%A %%B %%C %%D %%E %%F %%...