Search found 174 matches

by sambul35
11 Jun 2016 19:00
Forum: DOS Batch Forum
Topic: Start a program with Linux path argument from a batch
Replies: 10
Views: 9223

Re: Start a program with Linux path argument from a batch

Yes, there's a manpage with options, but... using them doesn't appear productive. I tried to run this, but it gives errors, since microApache is not registered as service in this application: %img% -d %dir% -n mapache.exe -f %cfg% -k restart :: error No installed service named "mapache.exe"...
by sambul35
11 Jun 2016 17:35
Forum: DOS Batch Forum
Topic: Start a program with Linux path argument from a batch
Replies: 10
Views: 9223

Re: Start a program with Linux path argument from a batch

MicroApache is controlled by another app service. But at times I need to re-start microApache in the background from Task Scheduler, if it fails to start due to target disk being inaccessible. I wonder if microApache has a commandline option to start in the background, so no hybrid batch is needed f...
by sambul35
11 Jun 2016 16:48
Forum: DOS Batch Forum
Topic: Start a program with Linux path argument from a batch
Replies: 10
Views: 9223

Re: Start a program with Linux path argument from a batch

The above suggestion however only addresses my 1st question about not recognizing the program path. What about my 2nd question about keeping microApache Cmd window closed while starting it from a batch called for example by Task Scheduler or double click? Now microApache window gets open, even if st...
by sambul35
11 Jun 2016 14:40
Forum: DOS Batch Forum
Topic: Start a program with Linux path argument from a batch
Replies: 10
Views: 9223

Re: Start a program with Linux path argument from a batch

Hmmm... I didn't expect that using /b switch isn't enough, but it did the trick. So it looks like Cmd can recognize forward slashes in arguments containing a Linux path . This syntax works well now from a batch: @echo off start "" /d "C:\Program Files (x86)\some_program\microapache&qu...
by sambul35
11 Jun 2016 13:57
Forum: DOS Batch Forum
Topic: Start a program with Linux path argument from a batch
Replies: 10
Views: 9223

Start a program with Linux path argument from a batch

I need to start a microApache server from a batch with its .conf file path as an argument. The problem is, to be recognized by microApache, the path must be in Linux format with forward slashes, which results in error when running the batch. I can't even find an escape character for "/" fo...
by sambul35
10 Jun 2016 10:30
Forum: DOS Batch Forum
Topic: batch file to continuous PING multiple IP and domain with date/timestamp on a notepad file
Replies: 16
Views: 15640

Re: batch file to continuous PING multiple IP and domain with date/timestamp on a notepad file

jepoytengco wrote:when I run this command, a command window opened up for a quick sec and disappeared.

To debug your code, open Cmd window first, then run the batch in it, post output here.
by sambul35
09 Jun 2016 11:01
Forum: DOS Batch Forum
Topic: Deleting a data subset from a set
Replies: 4
Views: 3991

Re: Deleting a data subset from a set

Thank you guys! Penpen's approach not using disk seems faster and more elegant. Not sure though, what "~" does in %%~b?
by sambul35
08 Jun 2016 20:44
Forum: DOS Batch Forum
Topic: Deleting a data subset from a set
Replies: 4
Views: 3991

Deleting a data subset from a set

Suppose I have 2 sets of data - numbers or single words separated by space:

a) 2 4 6 7 8 9 11 13 17 22 45 78
b) 2 7 9 11 15 19

What's the shortest code to remove all matching data in set b) from set a) ?
by sambul35
08 Jun 2016 20:27
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 57364

Re: Is it possible to break loop?

If you mean Infinite [FOR /L] loop with break condition , at quick reading the suggested solutions look too complex for my above task, and alternatively FINDSTR is slow in loops. Though this approach with the :WHILE function or that "restart the batch" one look promising. Also it shows, th...
by sambul35
08 Jun 2016 18:24
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 57364

Re: Is it possible to break loop?

You may get an equivalent behaviour of breaking the inner loop and passing to the next iteration of the outer loop if you enclose the body of inner loop in an IF controled by a break variable: @echo off for %%D in (1 2 3) do ( set break= for %%A in (1 2 3) do ( if not defined break ( echo D=%%D, A=...
by sambul35
03 Jun 2016 18:59
Forum: DOS Batch Forum
Topic: Extracting substring from a batch or function argument
Replies: 23
Views: 20926

Re: Extracting substring from a batch or function argument

Your "echo" choice sounds accurate. A new reader would likely say "these guys are definitely heading south". I'll get back to you on the above code after some reading comprehension. Don't forget however, the whole purpose of substitution in context of this thread is cutting down ...
by sambul35
02 Jun 2016 09:32
Forum: DOS Batch Forum
Topic: Extracting substring from a batch or function argument
Replies: 23
Views: 20926

Re: Extracting substring from a batch or function argument

But really, is it not easier to pass and work with the option name without having to strip off anything? May be... This seems to be the shortest code without redundancy, unless the calling sub name is transferred as a hidden arg similar to the call function name %~0 : @echo off setlocal EnableDelay...
by sambul35
02 Jun 2016 09:16
Forum: DOS Batch Forum
Topic: Extracting substring from a batch or function argument
Replies: 23
Views: 20926

Re: Extracting substring from a batch or function argument

I'd like to understand better exactly what you're trying to accomplish, and in what context. Thanks for the interesting questions. Basically, this thread is an attempt to figure out if a unified efficient approach is possible to decipher and verify various user inputs, entered: a) as arguments when...
by sambul35
01 Jun 2016 07:06
Forum: DOS Batch Forum
Topic: Extracting substring from a batch or function argument
Replies: 23
Views: 20926

Re: Extracting substring from a batch or function argument

Ooops... sorry, don't know how I missed that. Your substitution of a single variable with %%%1%% in a batch or function arguments does work well, and it seems to allow to program a function in a universal manner regardless of the variable name processed by it, thus eliminating the need to duplicate ...
by sambul35
31 May 2016 23:34
Forum: DOS Batch Forum
Topic: Extracting substring from a batch or function argument
Replies: 23
Views: 20926

Re: Extracting substring from a batch or function argument

If you refer to this your snippet, not sure what "pctsmb1" means, but I'm getting the output below if Echo is On and opt=8, and Cmd memory is broken after that: K:\Tests>test1 ECHO is on. K:\Tests>setlocal EnableDelayedExpansion K:\Tests>set "opt=8" K:\Tests>call :fun0 %% "&...