Search found 189 matches

by goodywp
21 Jun 2018 07:39
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

Re: which wildcard can be used in this case??

for %%f in ("C:\auto_pkg_build\Sources\Source_pkg\%opkg%\%optn%\Factory Download\TETRA\TELIUM3\%VAR14%\Schemes?to?Sign_for_%VAR001%.doc") do ( rename %%f Schemes_to_Sign_for_%VAR001%.doc Does this above command valid? rename %%f Schemes_to_Sign_for_%VAR001%.doc As I alluded to in my previous commen...
by goodywp
20 Jun 2018 12:50
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

Re: which wildcard can be used in this case??

OK, I think I had several try and get what I need for. Here is the one: cd "C:\auto_pkg_build\Sources\Source_pkg\%opkg%\%optn%\Factory Download\TETRA\TELIUM3\%VAR14%\" if exist *.doc ( rename *.doc Schemes_to_Sign_for_%VAR001%.doc So in this way, I can make sure the file format is always has undersc...
by goodywp
20 Jun 2018 09:33
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

Re: which wildcard can be used in this case??

If you don't need to access the matched file or know the exact file name, then using wildcard in combination with `IF` statement would suffice, but if there is a need to access the file afterwards (read contents of, know the exact file name, pass the file name to another program,...) then `FOR` sta...
by goodywp
20 Jun 2018 08:44
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

Re: which wildcard can be used in this case??

If you don't need to access the matched file or know the exact file name, then using wildcard in combination with `IF` statement would suffice, but if there is a need to access the file afterwards (read contents of, know the exact file name, pass the file name to another program,...) then `FOR` sta...
by goodywp
20 Jun 2018 08:40
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

Re: which wildcard can be used in this case??

Squashman wrote:
20 Jun 2018 07:08
A question mark for a single character.
Here is a good read for you.
viewtopic.php?t=6207
I tried it and not working. probably as sst said that I need to access the file...

Thanks anyway..
by goodywp
20 Jun 2018 06:17
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3189

which wildcard can be used in this case??

Hi all, I have a if statement as below: if exist "C:\auto_pkg_build\Sources\Source_pkg\%opkg%\%optn%\Factory Download\TETRA\TELIUM3\%VAR14%\Schemes to Sign_for_%VAR001%.doc" ( ....... ) Now the problem is that sometimes the format of this "Schemes to Sign_for_%VAR001%.doc" vary depend upon the devel...
by goodywp
20 Jun 2018 06:09
Forum: DOS Batch Forum
Topic: Way to replace string in word DOC ?
Replies: 12
Views: 2221

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: 2221

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: 2221

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: 1662

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: 1662

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: 1662

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: 1558

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: 1558

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 ('...