Search found 198 matches

by goodywp
20 Jun 2018 06:09
Forum: DOS Batch Forum
Topic: Way to replace string in word DOC ?
Replies: 12
Views: 3314

Re: Way to replace string in word DOC ?

I found some kind of bug in the return value of the Find.Execute method that makes the return value of the script rather ambiguous. E.g if you have the word abcx in your document and you want to replace abc , but only the whole word (using option /w). The Execute method returns true because it foun...
by goodywp
18 Jun 2018 14:18
Forum: DOS Batch Forum
Topic: Way to replace string in word DOC ?
Replies: 12
Views: 3314

Re: Way to replace string in word DOC ?

Okay here it goes ... Save with extension .bat @if (0)==(0) echo off &setlocal EnableExtensions DisableDelayedExpansion &set "wordrepl=cscript //nologo //e:jscript %~fs0" :: Usage: :: %wordrepl% FileName Find Replace [/i] [/w] [/a] [/b] [/e] [/p] :: FileName path of the Word document :: Find text t...
by goodywp
14 Jun 2018 08:11
Forum: DOS Batch Forum
Topic: Way to replace string in word DOC ?
Replies: 12
Views: 3314

Way to replace string in word DOC ?

Hi all, I know that the word document is GUI application and obviously so far to my knowledge can not be replacing string directly in command line. Someone suggested using 3rd party utility. Does anyone has some idea, suggestion or good experience on this matter? Your input shall be greatly apprecia...
by goodywp
14 Jun 2018 08:05
Forum: DOS Batch Forum
Topic: Any way to send log file or txt file into email
Replies: 5
Views: 2415

Re: Any way to send log file or txt file into email

Hi all, Thank you for all your response. I end up using a Python + Gmail as below code: from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP import smtplib import sys recipients = ['goodywp@hot...
by goodywp
01 Jun 2018 07:27
Forum: DOS Batch Forum
Topic: Any way to send log file or txt file into email
Replies: 5
Views: 2415

Re: Any way to send log file or txt file into email

Thanks Squashman as always !!!
by goodywp
31 May 2018 13:02
Forum: DOS Batch Forum
Topic: Any way to send log file or txt file into email
Replies: 5
Views: 2415

Any way to send log file or txt file into email

Hi all, It looks like that batch file itself can not send any log file or txt file into email recipient. Which one you suggest to use, I looked up on internet and blat is the one.. My purpose is to send out the log file and some error txt file into several email recipients to alert for the batch job...
by goodywp
10 May 2018 07:52
Forum: DOS Batch Forum
Topic: try to add one string just after another string with comma
Replies: 6
Views: 2406

Re: try to add one string just after another string with comma

You didn't provide any information with your code above, is it working as you wished, or are there one or more issues with it? Also, why are you thinking about the task in terms of search and replace? I see it as an insert task! The info provided in the first post. The original task was to re-set t...
by goodywp
08 May 2018 13:46
Forum: DOS Batch Forum
Topic: try to add one string just after another string with comma
Replies: 6
Views: 2406

Re: try to add one string just after another string with comma

Thanks compo Tried it out as below: @ECHO OFF set gen_sch=T501-08815-0103 set sl_sch=T501-08700-0100 set fk_sch=0501-08783-0100 Set "search=%gen_sch%" Set "replace=%gen_sch%,%sl_sch%" Set "textfile=Readme-how-to-use-this-package.txt" Set "newfile=indesnew.txt" ( For /F "Tokens=1* Delims=:" %%A In ('...
by goodywp
08 May 2018 09:24
Forum: DOS Batch Forum
Topic: try to add one string just after another string with comma
Replies: 6
Views: 2406

try to add one string just after another string with comma

I have a txt file, within this txt file, I have several lines, looks like below xxxxxx <T501-08815-0103, 0501-08783-0100> xxxxxx <T501-08815-0103> Now I would like to add one string: T501-08700-0100 just after sting T501-08815-0103 with a comma to separate them, so after adding, it should looks like...
by goodywp
19 Apr 2018 07:22
Forum: DOS Batch Forum
Topic: Try to read folder name then output partial name of the folder as variable
Replies: 5
Views: 1664

Re: Try to read folder name then output partial name of the folder as variable

What was wrong with using the FOR /F command as I provided it to you. Pretty sure it works the way you described your output in your first post in this thread. Let's just test that from the cmd prompt real quick. I:\>FOR /F "TOKENS=3* delims=-" %H in ("T501-08700-0100-T3_QA_Infra-SL_0102_signed_SL_...
by goodywp
18 Apr 2018 12:34
Forum: DOS Batch Forum
Topic: Try to read folder name then output partial name of the folder as variable
Replies: 5
Views: 1664

Re: Try to read folder name then output partial name of the folder as variable

pushd C:\auto_pkg_build\Sources\Source_schemes\QA_Infra for /D %%G in (*) DO ( FOR /F "TOKENS=3* delims=-" %%H in ("%%~G") DO echo %%I ) popd Thanks Squashman! I tried your code with a little change and got the expected results @ECHO OFF pushd C:\auto_pkg_build\Sources\Source_schemes\QA_Infra if ex...
by goodywp
18 Apr 2018 09:03
Forum: DOS Batch Forum
Topic: Try to read folder name then output partial name of the folder as variable
Replies: 5
Views: 1664

Try to read folder name then output partial name of the folder as variable

Hi, this time trying to output a folder name then output partial of its name into variable Let's say I got the following path showing the folder C:\auto_pkg_build\Sources\Source_schemes\QA_Infra\T501-08700-0100-T3_QA_Infra-SL_0102_signed_SL_Key_schemes_pack\T501-08700-0100\...\... Under Source_schem...
by goodywp
13 Apr 2018 14:14
Forum: DOS Batch Forum
Topic: how to read filename from folder then output as variable?
Replies: 6
Views: 1603

Re: how to read filename from folder then output as variable?

1) Debug the script. Remove the redirection and actually see if you are getting any output from the FOR command. 2)Show us real world examples of your file names. 3) Based on the obfuscated file name example you have given, you could just split the file name at the first underscore. @echo off if ex...
by goodywp
13 Apr 2018 10:05
Forum: DOS Batch Forum
Topic: how to read filename from folder then output as variable?
Replies: 6
Views: 1603

Re: how to read filename from folder then output as variable?

Should I go back and show you all your questions that we mentioned Delayed Expansion to you. But you do have a syntax problem with your substring in the SET command. I would bet we have shown you the proper syntax for that as well in plenty of your questions. set var=!var:~0,17! From one of your ve...