Search found 106 matches

by pstein
28 Nov 2018 05:15
Forum: DOS Batch Forum
Topic: How to I replace " by ' " (at the start and end of a string in a variable)? Doubling Backslashes?
Replies: 4
Views: 311

How to I replace " by ' " (at the start and end of a string in a variable)? Doubling Backslashes?

Assume I have a variable with a double quote enclosed string inside. Most simplified by a manual assigment like set myfile="D:\foo\bar\aaa\bbb.txt" How can I most easily replace the two enclosing " by ' ? How can I most easily replace the embedded single backslashes \ by double backslashes? Afterwar...
by pstein
28 Nov 2018 05:10
Forum: DOS Batch Forum
Topic: How to create an UTF-8 file (instead of UCS-2 Little Endian)?
Replies: 3
Views: 308

How to create an UTF-8 file (instead of UCS-2 Little Endian)?

Wehn I issue from a DOS batch file the following command:

echo foobar >myfile.txt

then myfile.txt will always be created as UCS-2 Little Endian based file

How can I tell the DOS batch execution to create an UTF-8 file instead?

Peter
by pstein
17 Nov 2018 10:28
Forum: DOS Batch Forum
Topic: How to pass params (=files) in the order I clicked them in Winexp?
Replies: 5
Views: 338

How to pass params (=files) in the order I clicked them in Winexp?

Assume I have (simplified) three files in a directory: 111.txt 222.txt 333.txt Now I click and mark (step by step) the files in the sequence 333.txt then 111.txt and finally 222.txt Afterwards I dragged the three marked files on a DOS batch shortcut on desktop for further processing. Unfortunately t...
by pstein
23 Sep 2018 03:04
Forum: DOS Batch Forum
Topic: Find recursively (!) all empty dirs below top folder?
Replies: 3
Views: 954

Re: Find recursively (!) all empty dirs below top folder?

@CirothUngol Thank you for your suggestion. You are right: Finally I want to remove all empty folders. But at first I want to list them only. Unfortunately your code produces an error: File Not Found ')ELSE' is not recognized as an internal or external command, operable program or batch file. Whats ...
by pstein
11 Sep 2018 02:22
Forum: DOS Batch Forum
Topic: Find recursively (!) all empty dirs below top folder?
Replies: 3
Views: 954

Find recursively (!) all empty dirs below top folder?

Assume I want to find all dirs below a certain top node folder (e.g. D:\data\logs\) which are emtpy?

"recursively" means if a dir contains only empty dirs (and no files) it should be considered as empty as well.

How can code this in a dos batch file?

Peter
by pstein
02 Jul 2018 03:35
Forum: DOS Batch Forum
Topic: Batch script stops forever when calling external exe program?
Replies: 2
Views: 712

Batch script stops forever when calling external exe program?

From within a ODS batch script I call/start an external program similar to ... D:\aaa\bbb\ccc\NetTraffic.exe Echo after call .... Yes, the external program is successfully started but the script does NOT continue to run. The Echo statement is never executed. Is this normal? That would mean I always ...
by pstein
27 Jun 2018 01:02
Forum: DOS Batch Forum
Topic: How to check (with "tasklist" built-in cmd) if prgm is running?
Replies: 9
Views: 1378

How to check (with "tasklist" built-in cmd) if prgm is running?

How do I check (from within a DOS batch script) if a certain program (with "Imagename" is myprog.exe") is currently running? I fiddled around with the built-in command "tasklist". But for example tasklist /FI "Imagename eq myprog.exe" echo el=%errorlevel% yields always 0 I need a return code or retu...
by pstein
11 Jun 2018 01:48
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 1607

Re: How to mask a blank inside nested quotes?

Sorry I have to revert back to this problem. At first thank you for the suggestions so far. But I am still fiddling around with the batch script. Originally I want to use the well known free cmdline tool ImageMagic available from here (scroll down for Win release): http://www.imagemagick.org/script/...
by pstein
28 May 2018 07:24
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 1607

How to mask a blank inside nested quotes?

Assume I have the folowing simplified code: set PROG=D:\tools\graphic tools\v7\ for /R . %%F in (.jpg) do ( for /F usebackq %%L in (`"%PROG%myprog.exe" ...... %%F`) do set %%L .... ) At first mind the blank inside the path. When I run this batch script I got the folowing error: 'D:\tools\graphic' is...
by pstein
24 Jan 2018 08:57
Forum: DOS Batch Forum
Topic: search command line tool to access remote POP3S mailbox
Replies: 1
Views: 684

search command line tool to access remote POP3S mailbox

From within a DOS batch script I want to check whether a certain remote mailbox (e.g. from gmail.com or hotmail.com) contains new messages. The messages should NOT be downloaded. I need just the information if there are some new message available. The connection should be established through STARTTL...
by pstein
09 Sep 2017 12:10
Forum: DOS Batch Forum
Topic: Searching easy way to remove double quotes around parameters?
Replies: 5
Views: 881

Re: Searching easy way to remove double quotes around parameters?

Hmm, I tried it again......and it works.

Must have been a bug in command interpreter the previous time

:-)

Thank you for the solution and sorry for the confusion
by pstein
09 Sep 2017 07:05
Forum: DOS Batch Forum
Topic: Searching easy way to remove double quotes around parameters?
Replies: 5
Views: 881

Re: Searching easy way to remove double quotes around parameters?

Sorry no.

The problem is that %1 contains from the very beginning a double quotes string like

%1 = "D:\foo\bar\mypic.hpg"

This implicite assignment is not done by me but the WindowsOS when I drap a file onto the batch script

Any other idea?
by pstein
09 Sep 2017 03:01
Forum: DOS Batch Forum
Topic: Searching easy way to remove double quotes around parameters?
Replies: 5
Views: 881

Searching easy way to remove double quotes around parameters?

I wrote a batch script which receives files with pathes as parameters. As set file=%1 echo processing %file% shows the file parameter is always enclosed in double quotes. How can I remove them in the most easy way (= a one liner)? Do I really have to use (two) substring operations on the variable? P...
by pstein
28 Aug 2017 04:43
Forum: DOS Batch Forum
Topic: How to delete all empty (sub)folders inside a dirtree?
Replies: 1
Views: 423

How to delete all empty (sub)folders inside a dirtree?

Assume I have the following topnode dir of a directory tree: D:\tools\aaa\logs\ How can I delete all empty folders inside this topnode? If the current directory contains an empty sub directory recursively then this should be deleted first.... How can I achieve this from dos batch script? The top nod...