Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Science is to computer science as hydrodynamics is to plumbing.


devel / alt.msdos.batch / Is there a way to put a command window in the background like Linux does (so that you can kill it)?

SubjectAuthor
* Is there a way to put a command window in the background like Linux does (so thaAndy Burnelli
+* Re: Is there a way to put a command window in the background likeKerr-Mudd, John
|`* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
| `* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|  `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|   +- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|   `* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|    `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|     +* Re: Is there a way to put a command window in the background likeAndy Burns
|     |`* Re: Is there a way to put a command window in the background likeMikeS
|     | `- Re: Is there a way to put a command window in the background likeKerr-Mudd, John
|     `* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|      `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|       `* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|        `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|         `* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|          +* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|          |+- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|          |`- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|          +* Re: Is there a way to put a command window in the background likeHerbert Kleebauer
|          |`- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|          `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|           `- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
+* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|`- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
+* Re: Is there a way to put a command window in the background like Linux does (soRobert Roland
|+* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
||`* Re: Is there a way to put a command window in the background like Linux does (soRobert Roland
|| `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
||  `- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
|`* The various kinds of Windows applications... (Was: Is there a way to put a commaKenny McCormack
| `- Re: The various kinds of Windows applications... (Was: Is there a way to put a cAndy Burnelli
+* Re: Is there a way to put a command window in the background likeMr. Man-wai Chang
|`- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
+* Re: Is there a way to put a command window in the background likeLori Fairhead
|`- Re: Is there a way to put a command window in the background likeHerbert Kleebauer
+- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
`* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
 `* Re: Is there a way to put a command window in the background like Linux does (soKenny McCormack
  `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
   `* Re: Is there a way to put a command window in the background likeKerr-Mudd, John
    +- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
    `* Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli
     `- Re: Is there a way to put a command window in the background like Linux does (soAndy Burnelli

Pages:12
Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3s52e$1ddc$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=164&group=alt.msdos.batch#164

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Thu, 21 Apr 2022 18:42:52 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3s52e$1ddc$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="46508"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Thu, 21 Apr 2022 17:42 UTC

Is there a way to put a command window in the background like Linux does
with the ampersand (so that you can kill the window but not the process)?

The problem that I have is I run a lot of commands from the Run icon in my
taskbar which bring up command windows to run scxripts but which leave
the unnecessary command window sitting around (which can be iconified).
<https://i.postimg.cc/Y00vx4yp/scrcpy04.jpg> Extraneous cmd window (&)

As an example, for years I've been running commands from a shortcut target
such as this target below which end up leaving an open command window in the
taskbar after they call the process, which itself opens up its own window.
%comspec% /k cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555

That reliably pops up the Android screen on Windows over Wi-Fi but then I
have absolutely no need for the command window to remain around as clutter.

Is there a way to get rid of the command Window and not kill the process?

In UNIX, I used to use the ampersand (&) to background the process.
The I could easily close the window & the background process would remain.

Does Windows have that concept of putting the command in the background so
that the window that called it can be closed (but the process remains)?

I have the same issue with openvpn windows where I don't need the extraneous
running open command window cluttering up what otherwise should be a clean
Windows user experience. I never enter another command in those windows.

And yet, I can accidentally interfere with the open window because it's
there and you can't get rid of it (other than to iconify it with the (-),
but it's still there on the otherwise clean taskbar, just waiting to be
opened by accident (and the icon looks like all other cmd window icons).

For those reasons...

Is there a way to background a Windows command (e.g., "&") and then we can
safely _close_ that extraneous running command window to reduce clutter?
--
Usenet is where kind-hearted people daily gather to voluntarily help others.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=165&group=alt.msdos.batch#165

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Thu, 21 Apr 2022 20:43:15 +0100
Organization: Dis
Lines: 51
Message-ID: <20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
References: <t3s52e$1ddc$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="cf0ca5d33cdf48c6fba9d6c87745d24a";
logging-data="1573"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pb1tb+mLW3QVzdoAt+WHGaXd2vjZ2nws="
Cancel-Lock: sha1:pW665HN8VHUGxwbswu5xTAZXEHE=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Thu, 21 Apr 2022 19:43 UTC

On Thu, 21 Apr 2022 18:42:52 +0100
Andy Burnelli <spam@nospam.com> wrote:

> Is there a way to put a command window in the background like Linux does
> with the ampersand (so that you can kill the window but not the process)?
>
> The problem that I have is I run a lot of commands from the Run icon in my
> taskbar which bring up command windows to run scxripts but which leave
> the unnecessary command window sitting around (which can be iconified).
> <https://i.postimg.cc/Y00vx4yp/scrcpy04.jpg> Extraneous cmd window (&)
>
> As an example, for years I've been running commands from a shortcut target
> such as this target below which end up leaving an open command window in the
> taskbar after they call the process, which itself opens up its own window.
> %comspec% /k cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555
>
> That reliably pops up the Android screen on Windows over Wi-Fi but then I
> have absolutely no need for the command window to remain around as clutter.
>

So why put in the parameter '/k'?

> Is there a way to get rid of the command Window and not kill the process?
Just never open it in the first place?

> In UNIX, I used to use the ampersand (&) to background the process.
> The I could easily close the window & the background process would remain.
>
> Does Windows have that concept of putting the command in the background so
> that the window that called it can be closed (but the process remains)?
>
> I have the same issue with openvpn windows where I don't need the extraneous
> running open command window cluttering up what otherwise should be a clean
> Windows user experience. I never enter another command in those windows.
>
> And yet, I can accidentally interfere with the open window because it's
> there and you can't get rid of it (other than to iconify it with the (-),
> but it's still there on the otherwise clean taskbar, just waiting to be
> opened by accident (and the icon looks like all other cmd window icons).
>
> For those reasons...
>
> Is there a way to background a Windows command (e.g., "&") and then we can
> safely _close_ that extraneous running command window to reduce clutter?
> --
> Usenet is where kind-hearted people daily gather to voluntarily help others.

--
Bah, and indeed Humbug.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3sgg5$j9f$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=166&group=alt.msdos.batch#166

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Thu, 21 Apr 2022 21:57:55 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3sgg5$j9f$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="19759"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Thu, 21 Apr 2022 20:57 UTC

Kerr-Mudd, John wrote:

>> That reliably pops up the Android screen on Windows over Wi-Fi but then I
>> have absolutely no need for the command window to remain around as clutter.
>>
>
> So why put in the parameter '/k'?

Good question.

The /k is mostly habit but it doesn't matter as you must use either /K or /C
and both do the exact same thing with respect to the window staying open.

%comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555

As a direct result of your query, I changed it to /c (you must use one or
the other as far as I know), but I knew it wouldn't matter as I've had this
problem for decades. I just never tried to resolve it until now.

The way Linux gets around it is the put the command in the background.
But I don't know how to put a Windows command in the background.

Does anyone know how to background a Windows command?

There might be something in the help for comspec though on the Linux-like
use of ampersand (&) to put the process into the background so that the
initiating command window can subsequently be closed.
%comspec% /? > comspec.man (See output in the sig.)
>> Is there a way to get rid of the command Window and not kill the process?
>
> Just never open it in the first place?

That would work if I knew how to run a command without ever opening a
command window. How is that done for the screen copy command shown above?
--
%comspec% /? > comspec.man

Starts a new instance of the Windows command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using ! as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
/V:OFF Disable delayed environment expansion.

Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes. Also, for compatibility
reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
same as /C. Any other switches are ignored.

If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:

1. If all of the following conditions are met, then quote characters
on the command line are preserved:

- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.

2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.

If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Command Extensions are enabled by default. You may also disable
extensions for a particular invocation by using the /E:OFF switch. You
can enable or disable extensions for all invocations of CMD.EXE on a
machine and/or user logon session by setting either or both of the
following REG_DWORD values in the registry using REGEDIT.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

to either 0x1 or 0x0. The user specific setting takes precedence over
the machine setting. The command line switches take precedence over the
registry settings.

In a batch file, the SETLOCAL ENABLEEXTENSIONS or DISABLEEXTENSIONS
arguments
takes precedence over the /E:ON or /E:OFF switch. See SETLOCAL /? for
details.

The command extensions involve changes and/or additions to the following
commands:

DEL or ERASE
COLOR
CD or CHDIR
MD or MKDIR
PROMPT
PUSHD
POPD
SET
SETLOCAL
ENDLOCAL
IF
FOR
CALL
SHIFT
GOTO
START (also includes changes to external command invocation)
ASSOC
FTYPE

To get specific details, type commandname /? to view the specifics.

Delayed environment variable expansion is NOT enabled by default. You
can enable or disable delayed environment variable expansion for a
particular invocation of CMD.EXE with the /V:ON or /V:OFF switch. You
can enable or disable delayed expansion for all invocations of CMD.EXE on a
machine and/or user logon session by setting either or both of the
following REG_DWORD values in the registry using REGEDIT.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion

to either 0x1 or 0x0. The user specific setting takes precedence over
the machine setting. The command line switches take precedence over the
registry settings.

In a batch file the SETLOCAL ENABLEDELAYEDEXPANSION or
DISABLEDELAYEDEXPANSION
arguments takes precedence over the /V:ON or /V:OFF switch. See SETLOCAL /?
for details.

If delayed environment variable expansion is enabled, then the exclamation
character can be used to substitute the value of an environment variable
at execution time.

You can enable or disable file name completion for a particular
invocation of CMD.EXE with the /F:ON or /F:OFF switch. You can enable
or disable completion for all invocations of CMD.EXE on a machine and/or
user logon session by setting either or both of the following REG_DWORD
values in the registry using REGEDIT.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
HKEY_LOCAL_MACHINE\Software\Microsoft\Command
Processor\PathCompletionChar

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
HKEY_CURRENT_USER\Software\Microsoft\Command
Processor\PathCompletionChar

with the hex value of a control character to use for a particular
function (e.g. 0x4 is Ctrl-D and 0x6 is Ctrl-F). The user specific
settings take precedence over the machine settings. The command line
switches take precedence over the registry settings.

If completion is enabled with the /F:ON switch, the two control
characters used are Ctrl-D for directory name completion and Ctrl-F for
file name completion. To disable a particular completion character in
the registry, use the value for space (0x20) as it is not a valid
control character.

Completion is invoked when you type either of the two control
characters. The completion function takes the path string to the left
of the cursor appends a wild card character to it if none is already
present and builds up a list of paths that match. It then displays the
first matching path. If no paths match, it just beeps and leaves the
display alone. Thereafter, repeated pressing of the same control
character will cycle through the list of matching paths. Pressing the
Shift key with the control character will move through the list
backwards. If you edit the line in any way and press the control
character again, the saved list of matching paths is discarded and a new
one generated. The same occurs if you switch between file and directory
name completion. The only difference between the two control characters
is the file completion character matches both file and directory names,
while the directory completion character only matches directory names.
If file completion is used on any of the built in directory commands
(CD, MD or RD) then directory completion is assumed.

The completion code deals correctly with file names that contain spaces
or other special characters by placing quotes around the matching path.
Also, if you back up, then invoke completion from within a line, the
text to the right of the cursor at the point completion was invoked is
discarded.


Click here to read the complete article
Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3sk11$1snj$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=167&group=alt.msdos.batch#167

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!vBFYSV/8mfYXfCBmCNCOJw.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Thu, 21 Apr 2022 23:57:52 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t3sk11$1snj$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="62195"; posting-host="vBFYSV/8mfYXfCBmCNCOJw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Thu, 21 Apr 2022 21:57 UTC

On 21.04.2022 22:57, Andy Burnelli wrote:
> Kerr-Mudd, John wrote:
>
>>> That reliably pops up the Android screen on Windows over Wi-Fi but then I
>>> have absolutely no need for the command window to remain around as clutter.
>>>
>>
>> So why put in the parameter '/k'?
>
> Good question.
>
> The /k is mostly habit but it doesn't matter as you must use either /K or /C
> and both do the exact same thing with respect to the window staying open.
>
> %comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555
>
> As a direct result of your query, I changed it to /c (you must use one or
> the other as far as I know), but I knew it wouldn't matter as I've had this
> problem for decades. I just never tried to resolve it until now.

It should matter. But I suppose scrcpy is a GUI program which will not
terminate itself. But if you exit scrcpy, then the CMD should also be closed.
If you don't want that the CMD windows stays open, then use "start scrcpy".

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3sv4a$1489$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=168&group=alt.msdos.batch#168

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 02:07:36 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3sv4a$1489$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="37129"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Fri, 22 Apr 2022 01:07 UTC

Herbert Kleebauer wrote:

> It should matter.

Well, to be clear, the "/c" vs "/k" matters sometimes.
But not in the case of GUI programs, as you already surmised.

> But I suppose scrcpy is a GUI program which will not
> terminate itself.

If I terminate the mirrored Android GUI window, the command window stays
open even as the scrcpy command running inside of it exits. If I instead
terminate that command window, then both the command window and the scrcpy
mirrored GUI are terminated.

> But if you exit scrcpy, then the CMD should also be closed.

In Linux, I'd simply add an ampersand (&) to the end of the scrcpy command.
That backgrounds the command such that killing the command window doesn't
affect any process which is running in the background (which then can be
brought to the fore when needed).

> If you don't want that the CMD windows stays open, then use "start scrcpy".

Hmmmmm.... gonna have to look that one up... and test to see if that works.

<https://stackoverflow.com/questions/8121238/start-comspec-c-script-cmd-vs-start-cmd-c-script-cmd>
"What is the difference between following commands:"
"start %comspec% /c script.cmd
"start cmd /C script.cmd"
"I need that cmd window for script.cmd should close automatically
when script.cmd is finished."
Drat. It's the right question, but all the "answers" are off topic.
(And the OP didn't chastise them for that. So there's no answer there.)

Given "Win+R > start" fails to find the executable, let me look for the
path... oh, geez, it's not an exexcutable in the normal sense of the word.
dir /s/a/l/on/b C:\Windows\*.* | findstr "start"

Ah! "start" is a special _internal_ command (much like "ver" is internal).
<https://www.computerhope.com/jargon/i/intecomm.htm>

That means "start" works _only_ inside an existing command window.
<https://www.computerhope.com/starthlp.htm>

So there's no way to use "start" without _first_ opening a command window.

I'm working on getting the syntax right to either call the shortcut.lnk
directly from the "Run" icon pinned to my taskbar, or, failing that, to pass
the "start" to the command window via the "Run" icon pinned to my taskbar.

The syntax isn't as easy to figure out as I would have thought due to the
parallel nature of the run command, complicated by the fact it is an
"internal command" so it only works _after_ the command window is opened.
--
<https://ss64.com/nt/start.html>
<https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/start>
<https://www.howtogeek.com/tips/how-to-run-a-scheduled-task-without-a-command-window-appearing/>
<https://www.windows-commandline.com/cmd-start-command/>

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3svo3$19oc$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=169&group=alt.msdos.batch#169

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 02:18:09 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3svo3$19oc$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="42764"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Fri, 22 Apr 2022 01:18 UTC

Andy Burnelli wrote:

> The syntax isn't as easy to figure out as I would have thought due to the
> parallel nature of the run command, complicated by the fact it is an
> "internal command" so it only works _after_ the command window is opened.

Ooops. To be clear... I meant the "start" command is parallel in nature.

Anyway, the problem is the parallel start syntax won't work in the Windows
Run box or in the shortcut TARGET field (so far, anyway on my need for a
linear "cd & adb & scrcpy" command sequence).

Working on that syntax right now... but if you've never tried to use the
internal "start" command, you might not realize that it fails 100% of the
time (so far) if you haven't figured out its arcane syntax requirements
(which I haven't figured out yet).

As one syntax example, apparently "start" _must_ be used _only_ with "/k".
<https://ss64.com/nt/start.html>
Otherwise, there's nothing left for remaining commands to run inside of.

And if you google for start syntax examples, they're all too simple:
<https://www.windows-commandline.com/cmd-start-command/>
Bear in mind, zero of these examples work in the "Run" box (so far anyway).

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3tfe4$1o5j$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=170&group=alt.msdos.batch#170

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!RnNAN21hxMjxEKu6GGfKGg.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 07:45:39 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t3tfe4$1o5j$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="57523"; posting-host="RnNAN21hxMjxEKu6GGfKGg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Fri, 22 Apr 2022 05:45 UTC

On 22.04.2022 03:07, Andy Burnelli wrote:

>
>> If you don't want that the CMD windows stays open, then use "start scrcpy".
>
> Hmmmmm.... gonna have to look that one up... and test to see if that works.

start /?

Why don't you just try your command with an added "start" before "scrcpy":

%comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555

If the CMD window still doesn't close, add a "&cls&exit"

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3tp6t$1njd$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=171&group=alt.msdos.batch#171

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 09:32:44 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3tp6t$1njd$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="56941"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Fri, 22 Apr 2022 08:32 UTC

Herbert Kleebauer wrote:

>>> If you don't want that the CMD windows stays open, then use "start scrcpy".
>>
>> Hmmmmm.... gonna have to look that one up... and test to see if that works.
>
> start /?

I think perhaps this task of killing the window is harder than it seems to be.

I ran that and I referenced all the online manpages; however, I haven't
_understood_ yet all the options, nor have I figured out which will work.

> Why don't you just try your command with an added "start" before "scrcpy":
> %comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555

Well, that _was_ the first thing I had tried; but all it did when I tried it
was _add_ another command window (which closed instantly); but otherwise
there was no change (in that what's left is the command window & the Android mirror).
> If the CMD window still doesn't close, add a "&cls&exit"

I think it may be harder to do than it at first appears to be.

%comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & cls & exit
%comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & exit
%comspec% /c cd /d "c:\app\editor\android\scrcpy" & adb connect 192.168.0.2:5555 & cls & start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & cls & exit
Unfortunately they still left the command window the same as before.

What they apparently killed was the penultimate adb server window
(whose standard out used to be combined with the scrcpy window apparently).

However clearing the screen and exiting _again_ didn't solve that issue
of the lingering command window when run from the "Run" icon:
%comspec% /c cd /d "c:\app\editor\android\scrcpy" & adb connect 192.168.0.2:5555 & cls & start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & cls & exit & cls & exit
%comspec% /c cd /d "c:\app\editor\android\scrcpy" & adb connect 192.168.0.2:5555 & start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & cls & exit & cls & exit
%comspec% /c cd /d "c:\app\editor\android\scrcpy" & adb connect 192.168.0.2:5555 & start scrcpy --always-on-top --tcpip=192.168.0.2:5555 & cls & exit & exit

It's interesting that with the &cls&exit, the adb output is missing;
but it still doesn't prevent the command window from lingering. Sigh.
--
& separates commands on a line.
&& executes this command only if previous command's errorlevel is 0.
|| (not used above) executes this command only if previous command's errorlevel is NOT 0
> output to a file
>> append output to a file
< input from a file
| output of one command into the input of another command
^ escapes any of the above, including itself, if needed to be passed to a program
" parameters with spaces must be enclosed in quotes
+ used with copy to concatenate files. E.G. copy file1+file2 newfile
, used with copy to indicate missing parameters. This updates the files modified date. E.G. copy /b file1,,
%variablename% a inbuilt or user set environmental variable
!variablename! a user set environmental variable expanded at execution time, turned with SetLocal EnableDelayedExpansion command
%<number> (%1) the nth command line parameter passed to a batch file. %0 is the batchfile's name.
%* (%*) the entire command line.
%<a letter> or %%<a letter> (%A or %%A) the variable in a for loop. Single % sign at command prompt and double % sign in a batch file.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<jcfaghFl2tdU1@mid.individual.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=172&group=alt.msdos.batch#172

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: use...@andyburns.uk (Andy Burns)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 10:23:27 +0100
Lines: 12
Message-ID: <jcfaghFl2tdU1@mid.individual.net>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 8L1TZm6Gf+i5QWW4kgy0Awjc89mtjUpoLck5tWZplVphFpKmWN
Cancel-Lock: sha1:MPTPYgY0CCgkKSI+IflIu/rR4kM=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Content-Language: en-GB
In-Reply-To: <t3tp6t$1njd$1@gioia.aioe.org>
 by: Andy Burns - Fri, 22 Apr 2022 09:23 UTC

Andy Burnelli wrote:

> I think it may be harder to do than it at first appears to be.

You're trying to do stuff that's kind of beyond CMD's capability, you can do
more with WSH (windows script host) or Powershell, if you haven't used WSH
before, I wouldn't recommend starting now, it's a dead-end.

A starting point, if it's of interest, there are many other ways to skin the cat

<https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2>

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3u478$tfu$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=173&group=alt.msdos.batch#173

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!RnNAN21hxMjxEKu6GGfKGg.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 13:40:23 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t3u478$tfu$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="30206"; posting-host="RnNAN21hxMjxEKu6GGfKGg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Herbert Kleebauer - Fri, 22 Apr 2022 11:40 UTC

On 22.04.2022 10:32, Andy Burnelli wrote:
> Herbert Kleebauer wrote:
>
>> Why don't you just try your command with an added "start" before "scrcpy":
>> %comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555

I don't know how you enter this command. If you type <WIN>R and enter the
following line:

%comspec% /c cd /d "c:\app\editor\android\scrcpy" && start notepad

notepad is started and the CMD window then closed. If you remove the
"start", the CMD window stays open until you exit notepad.

If you enter this command in an already open CMD window, then
it doesn't make any sense to start a new CMD window, just start a
batch with this content (or directly type the lines in the
open CMD window):

cd /d "c:\app\editor\android\scrcpy"
adb connect 192.168.0.2:5555
start scrcpy --always-on-top --tcpip=192.168.0.2:5555
exit

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3u5of$1k9u$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=174&group=alt.msdos.batch#174

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Nqwo/I7SrjMB9hDZaeYjog.user.46.165.242.75.POSTED!not-for-mail
From: Mik...@fred.com (MikeS)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 13:06:39 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3u5of$1k9u$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org> <jcfaghFl2tdU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="53566"; posting-host="Nqwo/I7SrjMB9hDZaeYjog.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: MikeS - Fri, 22 Apr 2022 12:06 UTC

On 22/04/2022 10:23, Andy Burns wrote:
> Andy Burnelli wrote:
>
>> I think it may be harder to do than it at first appears to be.
>
> You're trying to do stuff that's kind of beyond CMD's capability, you
> can do more with WSH (windows script host) or Powershell, if you haven't
> used WSH before, I wouldn't recommend starting now, it's a dead-end.
>
> A starting point, if it's of interest, there are many other ways to skin
> the cat
>
> <https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2>
>
>
I do what I think the OP wants by using this free utility:
https://www.robvanderwoude.com/files/consolestate.zip
https://www.robvanderwoude.com/helptext.php?src=consolestate_cs_help

A simple command line would be:
%comspec% /k cd /d "D:\" && consolestate.exe /Hide && Notepad.exe
which will run Notepad and leave it open but hide the command window.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<20220422132829.5922e76ac15afe23daa90456@127.0.0.1>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=175&group=alt.msdos.batch#175

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 13:28:29 +0100
Organization: Dis
Lines: 33
Message-ID: <20220422132829.5922e76ac15afe23daa90456@127.0.0.1>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org>
<t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org>
<t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org>
<jcfaghFl2tdU1@mid.individual.net>
<t3u5of$1k9u$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="56301d1ddfa39904aad3b792024e5bd8";
logging-data="13556"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NFcYODdDbtSyuN1tOQaJmbeKd5u9XzhY="
Cancel-Lock: sha1:RoVFCUC3Ju8x5RHh7SFXQoqdTHw=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Fri, 22 Apr 2022 12:28 UTC

On Fri, 22 Apr 2022 13:06:39 +0100
MikeS <MikeS@fred.com> wrote:

> On 22/04/2022 10:23, Andy Burns wrote:
> > Andy Burnelli wrote:
> >
> >> I think it may be harder to do than it at first appears to be.
> >
> > You're trying to do stuff that's kind of beyond CMD's capability, you
> > can do more with WSH (windows script host) or Powershell, if you haven't
> > used WSH before, I wouldn't recommend starting now, it's a dead-end.
> >
> > A starting point, if it's of interest, there are many other ways to skin
> > the cat
> >
> > <https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2>
> >
> >
> I do what I think the OP wants by using this free utility:
> https://www.robvanderwoude.com/files/consolestate.zip
> https://www.robvanderwoude.com/helptext.php?src=consolestate_cs_help

requires .Net

Just saying.
>
> A simple command line would be:
> %comspec% /k cd /d "D:\" && consolestate.exe /Hide && Notepad.exe
> which will run Notepad and leave it open but hide the command window.

--
Bah, and indeed Humbug.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t3v6h6$ol9$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=176&group=alt.msdos.batch#176

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Gj+613xB9sVIQxAtFideEw.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Fri, 22 Apr 2022 22:26:13 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t3v6h6$ol9$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org> <t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="25257"; posting-host="Gj+613xB9sVIQxAtFideEw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Fri, 22 Apr 2022 21:26 UTC

Herbert Kleebauer wrote:

>>> Why don't you just try your command with an added "start" before "scrcpy":
>>> %comspec% /c cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555
>
> I don't know how you enter this command.

Thanks for asking where I first test it in Win+R (only I have the "Run" icon pinned to my taskbar as shown in the graphic previously presented).
<https://i.postimg.cc/tTmdgKTB/scrcpy02.jpg> An efficient program setup

Once it works in the "Run" box, then I put it into a shortcut TARGET field.
(See the graphic above and below for those steps, as previously documented.)
<https://i.postimg.cc/Vvrq0K0m/scrcpy03.jpg> The efficient setup explained

> If you type <WIN>R and enter the
> following line:
>
> %comspec% /c cd /d "c:\app\editor\android\scrcpy" && start notepad
>
> notepad is started and the CMD window then closed.

Yup. But that's so easy, this does something similar but w/o the cmd window _needing_ to be opened (the point being that's far too easy of an example).
<https://i.postimg.cc/m2mYw789/notepad01.jpg>

Win+R > xx
Where "xx" is previously defined in the Windows registry for efficency as:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\xx.exe
@Default === C:\app\editor\txt\notepad++\notepad++.exe
For whatever reason, with the scrcpy command (which has to have adb prior),
it's not as easy to do as I would have hoped it would be, unfortunately.

> If you remove the
> "start", the CMD window stays open until you exit notepad.

I understand, but I think this is a deeper level problem set than the mere opening of a graphical tool.

An hint of the added layer of complexity is that when I used the start and killed the command window like you kindly had suggested, I noticed that the "adb" stdout didn't show up anymore in the remaining window (and, that a third window popped up and died instantly), and that the exit caused the stdout from adb (not scrcpy mind you, but adb) to be missing.

I know this because without the "start" & "&exit" stuff, adb would stay in the scrcpy command window and the kill-server of adb would also stay when the mirrored Android window was closed.

But with the "start" & "&exit", both of those stdout outputs disappeared.
(Clearly they were being fed to a window that was already closed.)

The point being that this is a bit more complicated than people think it is.
> If you enter this command in an already open CMD window, then
> it doesn't make any sense to start a new CMD window, just start a
> batch with this content (or directly type the lines in the
> open CMD window):
>
> cd /d "c:\app\editor\android\scrcpy"
> adb connect 192.168.0.2:5555
> start scrcpy --always-on-top --tcpip=192.168.0.2:5555
> exit

Let's keep in mind that efficiency and simplicity is the goal, always.
Let's try the sequence above to see what it does:

0. With the phone fifty feet away on a charger (but on Wi-Fi)
1. Run > cmd
2. C:\> ping 192.168.0.2 (don't worry about this technicality)
3. cd /d "c:\app\editor\android\scrcpy"
4. adb kill-server (don't worry about that technicality)
5. adb connect 192.168.0.2:5555
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.0.2:5555
6. start scrcpy --always-on-top --tcpip=192.168.0.2:5555

BTW, I probably do not need to specify the port the second
time in that sequence above; but I do it twice just in case.

Note that brings up two windows, one of which is the mirrored
Android window, and the other of which is the "scrcpy.exe" command window:
c:\app\editor\android\scrcpy\scrcpy.exe <== in the title bar
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.0.2:5555...
INFO: Connected to 192.168.0.2:5555
c:\app\editor\android\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 41.2 MB/s (41123 bytes in 0.001s)
[server] INFO: Device: samsung SM-A326U (Android 11)
INFO: Renderer: direct3d
INFO: Initial texture: 720x1600

Then I click the cursor to make the focus the command window & type:
7. exit

No go. You can't type _anything_ into the command window.
Nothing takes.

I had never _tried_ it before; but try as I might, the _only_ thing
you can do in that scrcpy command window is operate the Windows
border X box [x] and iconify box [-] and largify box [o].

I repeat. There is no possibility of typing _anything_ in that
scrcpy opened command window. I didn't know that before now.

Thank you for edifying me as I try _all_ reasonable suggestions.
And I report back what I found out (like all good netizens should).

In summary, I don't think this is as easy as it appears to be.
--
Usenet is where kind-hearted people daily gather to voluntarily help others.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t408to$pcd$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=177&group=alt.msdos.batch#177

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Li8sO5f59M5L2lukXxusnw.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 09:12:55 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t408to$pcd$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org>
<t3v6h6$ol9$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="25997"; posting-host="Li8sO5f59M5L2lukXxusnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Sat, 23 Apr 2022 07:12 UTC

On 22.04.2022 23:26, Andy Burnelli wrote:

> Note that brings up two windows, one of which is the mirrored
> Android window, and the other of which is the "scrcpy.exe" command window:

Then scrcpy.exe uses both, a GUI window and a console. But that has
nothing to do with the CMD window. You can't close this console because
the program needs it (maybe for some status or error output).

If you start scrcpy.exe by a mouse click, both windows should be created.
If you start it within a CMD window, scrcpy.exe should use the CMD
window as console, so no new console is created and CMD is suspended until
scrcpy.exe is closed. If you start it with "start scrcpy.exe" in a cmd
window, then a new console is created and CMD get control back over its
console immediately.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t40rr2$93a$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=178&group=alt.msdos.batch#178

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Gj+613xB9sVIQxAtFideEw.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 13:36:01 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t40rr2$93a$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org> <t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org> <t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="9322"; posting-host="Gj+613xB9sVIQxAtFideEw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Sat, 23 Apr 2022 12:36 UTC

Herbert Kleebauer wrote:

>> Note that brings up two windows, one of which is the mirrored
>> Android window, and the other of which is the "scrcpy.exe" command window:
>
> Then scrcpy.exe uses both, a GUI window and a console.
> But that has nothing to do with the CMD window.

Everything you said is correct.
Hence I apologize for being confused prior. Thank you for clarifying.

You (and Andy Burns) know more about Windows & command actions than I ever
will know, so I sincerely want to thank you for your kind-hearted help.

You are right. I was wrong. I ran all your tests (see below) and they worked
_exactly_ as you surmised they would.

> You can't close this console because
> the program needs it (maybe for some status or error output).

Yes. You are correct. I will give up on trying to close the "scrcpy console"
as the developers, for whatever reason, _want_ it to remain visible.

It's rare for me to fail to wrest control of Windows, but in this case, I
will admit defeat in that I can't get rid of that "scrcpy console" window
(other than to iconify it).

> If you start scrcpy.exe by a mouse click, both windows should be created.

You are correct.
The total number of windows depends on _how_ I run the command.

1. There is whatever "thing" the command is run inside of
a. That can be a CMD window
b. That can be a RUN box
c. That can be a shortcut TARGET
2. Then there is the "scrcpy console" window.
3. And then there is the resulting Android GUI.

As you correctly surmised, depending on _where_ I execute the scrcpy
command, the result could be two or three windows; but in every case, I
can't "kill" the scrcpy console (which was my original goal).

> If you start it within a CMD window, scrcpy.exe should use the CMD
> window as console, so no new console is created and CMD is suspended until
> scrcpy.exe is closed.

This is correct.

Here is a step-by-step test with the phone on the Wi-Fi network.
A. Run > cmd
B. ping 192.168.0.2 (just to ensure the TCP/IP connection is alive)
C. cd c:\app\editor\android\scrcpy
D. adb kill-server (this gives me a known baseline starting point)
E. adb connect 192.168.0.2:5555 (this returns me to the cmd prompt)
F. scrcpy (the CMD window turns into a scrcpy console)

As you correctly surmised, that does _two_ things:
1. The "scrcpy" console takes over the CMD window.
2. The Android GUI pops up

Then, when I press the Windows [x] box in the Android GUI...
1. That [x] kills the Android GUI window
2. And it kills the scrcpy process in the CMD window
3. Which gets me back the command prompt in the CMD window

> If you start it with "start scrcpy.exe" in a cmd
> window, then a new console is created and CMD get control back over its
> console immediately.

You are correct.

Here is a step-by-step test with the phone on the Wi-Fi network.
A. Run > cmd
B. ping 192.168.0.2
C. cd c:\app\editor\android\scrcpy
D. adb kill-server
E. adb connect 192.168.0.2:5555 (this returns me to the cmd prompt)
F. start scrcpy (this opens up a _separate_ scrcpy console)

That does _three_ things:
1. It opens up a _new_ console for the "scrcpy" output.
2. The Android GUI pops up
3. And it returns me to the cmd prompt in the cmd window
(I can close that command window without affecting anything else.)

Likewise, three windows open up if I put this in a shortcut TARGET:
TARGET=%comspec% /k cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555
a. It opens a cmd window
b. It opens a separate scrcpy console
c. It opens the Android GUI

The cmd window can be killed separately but killing either the Android GUI
or the scrpcpy console will kill both.

Lastly, this opens up three windows but instantly kills one of them:
TARGET=%comspec% /k cd /d "c:\app\editor\android\scrcpy" && adb connect 192.168.0.2:5555 && start scrcpy --always-on-top --tcpip=192.168.0.2:5555 &cls&exit
a. It opens a cmd window
b. It opens a separate scrcpy console
c. It opens the Android GUI
d. Then it kills the cmd window

In summary, you were always correct and I was confused - but in the end, I
agree with you on everything you've tried to help me to understand.

The net is that I can't easily get rid of the scrcpy console.
Thanks for your kind help and advice.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t40u8n$17kt$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=179&group=alt.msdos.batch#179

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Gj+613xB9sVIQxAtFideEw.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 14:17:26 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t40u8n$17kt$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="40605"; posting-host="Gj+613xB9sVIQxAtFideEw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Sat, 23 Apr 2022 13:17 UTC

Zaidy036 wrote:

>> Is there a way to background a Windows command (e.g., "&") and then we can
>> safely _close_ that extraneous running command window to reduce clutter?
>
> Use Schtasks and select "hide" then run from shortcut

This works to bring up the Android GUI using the Task Scheduler.
But it still creates two windows (scrcpy console and Android GUI).

Create shortcut:
TARGET=C:\Windows\System32\schtasks.exe /run /TN "task scrcpy_1"
Name=task scrcpy

Doubleclick on that shortcut "task scrcpy.lnk" to execute it.

Run > taskschd.msc > Task Scheduler Library > RMB Create Task >
General:
Name = task scrcpy
[x]Hidden
Actions > New
Action = Start a program
Program/script = %comspec%
Add arguments = /c start "" adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555
Start in = c:\app\editor\android\scrcpy

Note that whether or not the [x]Hidden" box was checked,
the result was the same two windows.
a. The scrcpy console window
b. The Android GUI window

This didn't work because it killed all the windows.
Add arguments = /c start "" adb connect 192.168.0.2:5555 && scrcpy --always-on-top --tcpip=192.168.0.2:5555 &cls&exit

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t40un5$1d2d$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=180&group=alt.msdos.batch#180

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Gj+613xB9sVIQxAtFideEw.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 14:25:09 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t40un5$1d2d$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <t40u8n$17kt$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="46157"; posting-host="Gj+613xB9sVIQxAtFideEw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Sat, 23 Apr 2022 13:25 UTC

Andy Burnelli wrote:

> Create shortcut:
> TARGET=C:\Windows\System32\schtasks.exe /run /TN "task scrcpy_1"

Typo (as I had named each test "task scrcpy_1", "task scrcpy_2", etc.

Correction:
TARGET=C:\Windows\System32\schtasks.exe /run /TN "task scrcpy"

The end result is that the Task Scheduler "[x]Hidden" option didn't seem to
do anything useful in terms of whether or not the "scrcpy console" remained
open and alive after the "task scrcpy" shortcut was doubleclicked.

Sigh.
At this point I think I will give up on trying to get rid of the "scrcpy
console" window. I'll just manually iconify it when it pops up each time.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<k3v76h515r5cluk8hcpgnrgf1r05l63rkf@4ax.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=181&group=alt.msdos.batch#181

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: fak...@ddress.no (Robert Roland)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 15:46:05 +0200
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <k3v76h515r5cluk8hcpgnrgf1r05l63rkf@4ax.com>
References: <t3s52e$1ddc$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="018d7fd70b64e94e82a691d7960b904b";
logging-data="23178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185SG+cEfddMm8viM9AVG/C"
Cancel-Lock: sha1:2LC7Uog5dTw7o4FFsmFP8gg+d9s=
X-Newsreader: Forte Agent 4.2/32.1117
 by: Robert Roland - Sat, 23 Apr 2022 13:46 UTC

On Thu, 21 Apr 2022 18:42:52 +0100, Andy Burnelli <spam@nospam.com>
wrote:

>Is there a way to get rid of the command Window and not kill the process?

Herbert has already nailed it, but let me elaborate a bit.

In Windows, there are two types of programs: Console applications and
pure GUI applications.

It is not always easy to spot which is which, because a console
application can also create graphical windows.

A console application tells Windows that it needs a console, and
Windows will provide one. In Task Manager, you will see conhost.exe,
which is Windows' console. Some people think CMD.EXE is the console,
but it is not. CMD.EXE is just a console application. It requires
conhost.exe, just like the other console applications.

Your scrcpy program is a console application. It needs the console in
order to live. Like all console applications, if you kill the console,
the applications also dies.

There are ways to hide a window. There is a fourth "windowstyle" in
addition to "Maximized", "Minimized" and "Normal". It is called
"Hidden".

In your case, you mentioned that closing the graphical window will not
terminate the application. If the console window is hidden, this might
mean that you will have no way of terminating the application other
than killing it in Task Manager.

How do you normally terminate the application?
--
RoRo

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t41480$1jiu$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=182&group=alt.msdos.batch#182

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 15:59:27 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t41480$1jiu$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <k3v76h515r5cluk8hcpgnrgf1r05l63rkf@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="52830"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Sat, 23 Apr 2022 14:59 UTC

Robert Roland wrote:

> In Windows, there are two types of programs: Console applications and
> pure GUI applications.
>
> It is not always easy to spot which is which, because a console
> application can also create graphical windows.
>
> A console application tells Windows that it needs a console, and
> Windows will provide one. In Task Manager, you will see conhost.exe,
> which is Windows' console. Some people think CMD.EXE is the console,
> but it is not. CMD.EXE is just a console application. It requires
> conhost.exe, just like the other console applications.
>
> Your scrcpy program is a console application. It needs the console in
> order to live. Like all console applications, if you kill the console,
> the applications also dies.

Wow. That was a very nice explanation. Thank you for helping out.
> There are ways to hide a window. There is a fourth "windowstyle" in
> addition to "Maximized", "Minimized" and "Normal". It is called
> "Hidden".

When you say "window" in that sentence, with respect to the option of having
that window be "hidden", can the scrcpy "console" window be hidden?

> In your case, you mentioned that closing the graphical window will not
> terminate the application.

Actually, if I said that, I was wrong.
a. Closing the graphical Android window will close the scrcpy console too.
b. And vice versa. Closing the scrcpy console will close the Android GUI.

> If the console window is hidden, this might
> mean that you will have no way of terminating the application other
> than killing it in Task Manager.

Actually, hiding the scrcpy console window is _exactly_ what I want.
There isn't any way to interact with it (AFAIK); so it's just a waste
(IMHO). I'm sure the developers think it's useful; but I don't see any value
in it so I Minimize it but that means I still have to deal with it being
there adding to clutter on my taskbar.
> How do you normally terminate the application?

Normally I hit the "[x]" button on the Window of the graphical Android GUI.
That kills both the Android GUI window & the scrcpy console window.

How can I tell the "scrcpy console" to be hidden?

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t414hd$1ncm$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=183&group=alt.msdos.batch#183

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Li8sO5f59M5L2lukXxusnw.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 17:04:11 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t414hd$1ncm$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org>
<t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org>
<t40rr2$93a$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="56726"; posting-host="Li8sO5f59M5L2lukXxusnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Sat, 23 Apr 2022 15:04 UTC

On 23.04.2022 14:36, Andy Burnelli wrote:

> The net is that I can't easily get rid of the scrcpy console.

I don't understand why you want to hide the console, but this
should do it (untested, I don't have a program which uses
a GUI window and a console). Just start the below batch.
If it works, you can store showwin.exe somewhere in your
PATH, so you don't have to create it temporarily every
time you execute the batch. I post the usage of showwin.exe
in a follow up.

@echo off
certutil -f -decode %~f0 showwin.exe>nul

cd /d "c:\app\editor\android\scrcpy"
adb connect 192.168.0.2:5555

:: now we hide console window
showwin.exe 0

scrcpy --always-on-top --tcpip=192.168.0.2:5555

:: after scrcpy is closed we show console window again
showwin.exe 5

del showwin.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcyBwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
AAAAAAAAAADIEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAAAAAAQAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAAmAQAAABAAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAAAAAJQQAACmEAAA
uhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIQQAAAAAAAAAAAAAHYQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAAAAAAAAU2hvd1dp
bmRvdwAAS0VSTkVMMzIuZGxsAACUEAAAphAAALoQAAAAAAAAAABHZXRDb21tYW5k
TGluZUEAAABHZXRDb25zb2xlV2luZG93AAAAAEV4aXRQcm9jZXNzAP8VCBBAADHS
SECAOAB0EYA4InUC99IJ0nXvgDggdepAMfa9BQAAAA+2EEAI0nQTgOowcvOA+gl3
7mv2CgHWMe3r5QntdAKJ7v8VDBBAAFZQ/xUAEEAAagD/FRAQQAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t414n8$1prh$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=184&group=alt.msdos.batch#184

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Li8sO5f59M5L2lukXxusnw.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 17:07:20 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t414n8$1prh$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org>
<t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org>
<t40rr2$93a$1@gioia.aioe.org> <t414hd$1ncm$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="59249"; posting-host="Li8sO5f59M5L2lukXxusnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Content-Language: de-DE
X-Notice: Filtered by postfilter v. 0.9.2
 by: Herbert Kleebauer - Sat, 23 Apr 2022 15:07 UTC

On 23.04.2022 17:04, Herbert Kleebauer wrote:

> I post the usage of showwin.exe

@echo off
:: minimize/maximize/hide the command window (requires W2k or better).
::
:: Usage: showwin.exe number
::
:: 0 SW_HIDE
:: Hides the window and activates another window.
::
:: 1 SW_SHOWNORMAL
:: Activates and displays a window. If the window is minimized or maximized,
:: the system restores it to its original size and position. An application
:: should specify this flag when displaying the window for the first time.
::
:: 2 SW_SHOWMINIMIZED
:: Activates the window and displays it as a minimized window.
::
:: 3 SW_MAXIMIZE
:: Maximizes the specified window.
::
:: 3 SW_SHOWMAXIMIZED
:: Activates the window and displays it as a maximized window.
::
:: 4 SW_SHOWNOACTIVATE
:: Displays a window in its most recent size and position. This value is
:: similar to SW_SHOWNORMAL, except the window is not actived.
::
:: 5 SW_SHOW
:: Activates the window and displays it in its current size and position.
::
:: 6 SW_MINIMIZE
:: Minimizes the specified window and activates the next top-level window
:: in the Z order.
::
:: 7 SW_SHOWMINNOACTIVE
:: Displays the window as a minimized window. This value is similar to
:: SW_SHOWMINIMIZED, except the window is not activated.
::
:: 8 SW_SHOWNA
:: Displays the window in its current size and position. This value is
:: similar to SW_SHOW, except the window is not activated.
::
:: 9 SW_RESTORE
:: Activates and displays the window. If the window is minimized or maximized,
:: the system restores it to its original size and position. An application
:: should specify this flag when restoring a minimized window.
::
:: 10 SW_SHOWDEFAULT
:: Sets the show state based on the SW_ value specified in the STARTUPINFO
:: structure passed to the CreateProcess function by the program that
:: started the application.
::
:: 11 SW_FORCEMINIMIZE
:: Windows 2000/XP: Minimizes a window, even if the thread that owns the
:: window is not responding. This flag should only be used when minimizing
:: windows from a different thread.

certutil -f -decode %~f0 showwin.exe>nul

cls
dir
:: wait 4 seconds
ping -n 4 localhost >nul
:: hide window
showwin.exe 0
dir /b
:: wait 4 seconds
ping -n 4 localhost >nul
:: show window
showwin.exe 5
:: wait 4 seconds
ping -n 4 localhost >nul
del showwin.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcyBwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
AAAAAAAAAADIEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAAAAAAQAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAAmAQAAABAAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAAAAAJQQAACmEAAA
uhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIQQAAAAAAAAAAAAAHYQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAAAAAAAAU2hvd1dp
bmRvdwAAS0VSTkVMMzIuZGxsAACUEAAAphAAALoQAAAAAAAAAABHZXRDb21tYW5k
TGluZUEAAABHZXRDb25zb2xlV2luZG93AAAAAEV4aXRQcm9jZXNzAP8VCBBAADHS
SECAOAB0EYA4InUC99IJ0nXvgDggdepAMfa9BQAAAA+2EEAI0nQTgOowcvOA+gl3
7mv2CgHWMe3r5QntdAKJ7v8VDBBAAFZQ/xUAEEAAagD/FRAQQAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

The source code:

winmain::
jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: eor.l r5,r5
move.l #5,r4 ; default: SW_SHOW
_50: movu.bl (r0),r1
inc.l r0
or.b r1,r1
beq.b _40
sub.b #'0',r1
bcs.b _50
cmp.b #9,r1
bhi.b _50
mulsq.l #10,r5,r5
add.l r1,r5
eor.l r4,r4
br.b _50
_40: or.l r4,r4
beq.b _60
move.l r4,r5

_60: jsr.l (GetConsoleWindow)

move.l r5,-(sp)
move.l r0,-(sp)
jsr.l (ShowWindow)

moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t4155o$11d$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=185&group=alt.msdos.batch#185

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!Li8sO5f59M5L2lukXxusnw.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 17:15:04 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t4155o$11d$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
<20220421204315.03ff044cdeef898a513382f1@127.0.0.1>
<t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org>
<t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org>
<t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org>
<t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org>
<t40rr2$93a$1@gioia.aioe.org> <t414hd$1ncm$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="1069"; posting-host="Li8sO5f59M5L2lukXxusnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: de-DE
 by: Herbert Kleebauer - Sat, 23 Apr 2022 15:15 UTC

On 23.04.2022 17:04, Herbert Kleebauer wrote:
> @echo off
> certutil -f -decode %~f0 showwin.exe>nul
>
> cd /d "c:\app\editor\android\scrcpy"
> adb connect 192.168.0.2:5555

You have to do the cd before creating the exe

> @echo off

> cd /d "c:\app\editor\android\scrcpy"
> certutil -f -decode %~f0 showwin.exe>nul
>
> adb connect 192.168.0.2:5555

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t418v5$tug$1@toylet.eternal-september.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=186&group=alt.msdos.batch#186

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!toylet.eternal-september.org!.POSTED!not-for-mail
From: toylet.t...@gmail.com (Mr. Man-wai Chang)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like
Linux does (so that you can kill it)?
Date: Sun, 24 Apr 2022 00:19:35 +0800
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <t418v5$tug$1@toylet.eternal-september.org>
References: <t3s52e$1ddc$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Apr 2022 16:19:49 -0000 (UTC)
Injection-Info: toylet.eternal-september.org; posting-host="5176100c2032213c58166df97a9805c9";
logging-data="30672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186qY1vbF2vYwok2MBeIkCw"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Cancel-Lock: sha1:LrMS9gH/110iSm79Yk8XzaACJz4=
In-Reply-To: <t3s52e$1ddc$1@gioia.aioe.org>
Content-Language: en-US
 by: Mr. Man-wai Chang - Sat, 23 Apr 2022 16:19 UTC

On 22/4/2022 1:42 am, Andy Burnelli wrote:
> Is there a way to put a command window in the background like Linux does
> with the ampersand (so that you can kill the window but not the process)?
>
> The problem that I have is I run a lot of commands from the Run icon in my
> taskbar which bring up command windows to run scxripts but which leave
> the unnecessary command window sitting around (which can be iconified).
> <https://i.postimg.cc/Y00vx4yp/scrcpy04.jpg> Extraneous cmd window (&)

Using a freeware like Trayit?

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t4193j$1luf$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=187&group=alt.msdos.batch#187

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 17:22:26 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t4193j$1luf$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org> <t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org> <t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org> <t40rr2$93a$1@gioia.aioe.org> <t414hd$1ncm$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="55247"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Sat, 23 Apr 2022 16:22 UTC

Herbert Kleebauer wrote:

> I don't understand why you want to hide the console,

That worked like a charm!
<https://i.postimg.cc/CxXH6N2r/scrcpy13.jpg>

[sidenote]
At first there was an error window that popped up telling me that
the 32-bitness wasn't compatible with the 64-bitness of my computer;
but they stopped popping up. Also at first nothing happened, but
then later it worked consistently. I didn't document that fully.
[/sidenote]

I tried the series of tests below _before_ reading your two updates.
(So this response is only with respect to the article I'm replying to.)

My Use Model:
a. I click the Run box & type "mirror" & up comes _only_ the Android GUI.
b. Or, I doubleclick the showbat.lnk" shortcut pinned to the taskbar.
c. Up comes _only_ the Android GUI (there is no longer the scrcpy console!)

Woo hoo! You solved the problem set.
This technique should work for many similar issues.

> but this
> should do it (untested, I don't have a program which uses
> a GUI window and a console). Just start the below batch.

Test sequence #1:
a. I put the batch file into my C:\app\editor\android\scrcpy folder
b. I opened a command window in that folder & ran the executable
c. I also ran the command using the full path from the Run box
Run > C:\app\editor\android\scrcpy\showwin.bat

This popped up _only_ one window... the Android GUI!
<https://i.postimg.cc/nV6K0Cfn/scrcpy08.jpg> showwin.bat full path

> If it works, you can store showwin.exe somewhere in your
> PATH, so you don't have to create it temporarily every
> time you execute the batch. I post the usage of showwin.exe
> in a follow up.

I see there are two followups where the tests below are BEFORE
I read your useage followups as I was adding the efficiency steps.

Test sequence #2:
a. I put the batch file into my C:\app\editor\android\scrcpy folder
b. I added a Registry AppPaths key to enable "Run > mirror"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mirror.exe]
[@Default=C:\app\editor\android\scrcpy\showwin.bat]
<https://i.postimg.cc/66Gn2t2g/scrcpy09.jpg>
c. That sort of worked in that the GUI came up but so did the console.
<https://i.postimg.cc/htMdWG6z/scrcpy10.jpg>

Test sequence #3:
a. I put the batch file into my C:\app\editor\android\scrcpy folder
b. I added a shortcut whose TARGET was the showwin.bat command
NAME=C:\link\editor\android\scrcpy\showwin.lnk
TARGET=C:\app\editor\android\scrcpy\showwin.bat
<https://i.postimg.cc/7LWJhWxq/scrcpy11.jpg>
c. That worked perfectly in that the GUI came up but not the console!

Test sequence #4:
a. I put the batch file into my C:\app\editor\android\scrcpy folder
b. I added a shortcut whose TARGET was the showwin.bat command
NAME=C:\link\editor\android\scrcpy\showwin.lnk
TARGET=C:\app\editor\android\scrcpy\showwin.bat
<https://i.postimg.cc/7LWJhWxq/scrcpy11.jpg>
c. I modified that Registry AppPaths key that created "Run > mirror"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mirror.exe]
[@Default=C:\link\editor\android\scrcpy\showwin.lnk]
<https://i.postimg.cc/yYKNnHxD/scrcpy12.jpg>
d. That worked perfectly in that the GUI came up but not the console!
<https://i.postimg.cc/CxXH6N2r/scrcpy13.jpg>

Note that the last test would have worked the same had the
Windows registry "mirror.exe" key been set to the batch file
instead of to the shortcut "showwin.lnk" (either way works).

Woo hoo! No console. This is wonderful Windows magic indeed!
Thanks!
--
I didn't read your next two posts as I was working on this one
when I just noticed those two extra use-model posts came in.

Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?

<t41at0$fa0$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=188&group=alt.msdos.batch#188

 copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch alt.comp.microsoft.windows
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Subject: Re: Is there a way to put a command window in the background like Linux does (so that you can kill it)?
Date: Sat, 23 Apr 2022 17:53:03 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t41at0$fa0$1@gioia.aioe.org>
References: <t3s52e$1ddc$1@gioia.aioe.org> <20220421204315.03ff044cdeef898a513382f1@127.0.0.1> <t3sgg5$j9f$1@gioia.aioe.org> <t3sk11$1snj$1@gioia.aioe.org> <t3sv4a$1489$1@gioia.aioe.org> <t3tfe4$1o5j$1@gioia.aioe.org> <t3tp6t$1njd$1@gioia.aioe.org> <t3u478$tfu$1@gioia.aioe.org> <t3v6h6$ol9$1@gioia.aioe.org> <t408to$pcd$1@gioia.aioe.org> <t40rr2$93a$1@gioia.aioe.org> <t414hd$1ncm$1@gioia.aioe.org> <t4155o$11d$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="15680"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andy Burnelli - Sat, 23 Apr 2022 16:53 UTC

Herbert Kleebauer wrote:

> You have to do the cd before creating the exe

That's maybe why the one test of calling the showwin.bat
by its full path didn't work when run directly out of the Windows registry.
<https://i.postimg.cc/66Gn2t2g/scrcpy09.jpg>

I'll switch the order to bring up the CD earlier after I post this.

But that's OK because _all_ the other tests worked perfectly;
and, likely I could have put the full path in the batch file
and then that one test would also have worked (most likely).

> I don't understand why you want to hide the console,

I forgot to answer this perfectly valid question from you.
I apologize.

The reason is that the scrcpy console does nothing for me.
a. The console just gets in the way (as it has no way to interact with it).
b. The scrcpy console has to be manually minimized to get it out of the way.
c. And the scrcpy console uses up a precious slot on the taskbar.
d. Plus, it doesn't tell me anything that I want to know (if things work).

All of that is bad. None of that is good.
It's not horrible. But there's nothing good about any of that.

With the batch script, there is now no need to deal with the scrcpy console!
Thank you for helping me, and by way of extension, all the lurkers too.

BTW, here are the screenshots all together that were made for this thread.
<https://i.postimg.cc/CxXH6N2r/scrcpy13.jpg> No scrcpy console window!
<https://i.postimg.cc/yYKNnHxD/scrcpy12.jpg> REG test of showwin.lnk
<https://i.postimg.cc/7LWJhWxq/scrcpy11.jpg> Shortcut test of showwin.lnk
<https://i.postimg.cc/htMdWG6z/scrcpy10.jpg> The console came up :(
<https://i.postimg.cc/66Gn2t2g/scrcpy09.jpg> REG test of showwin.bat
<https://i.postimg.cc/nV6K0Cfn/scrcpy08.jpg> CMD test of showwin.bat
<https://i.postimg.cc/hjkVFyqJ/scrcpy07.jpg> Android mnt as drive letter
<https://i.postimg.cc/Sx1hgWmY/scrcpy06.jpg> Press two hardware buttons
<https://i.postimg.cc/wvsbcNBz/scrcpy05.jpg> Drag APK from Windows
<https://i.postimg.cc/Y00vx4yp/scrcpy04.jpg> Extraneous cmd window (&)
<https://i.postimg.cc/Vvrq0K0m/scrcpy03.jpg> The efficient setup explained
<https://i.postimg.cc/tTmdgKTB/scrcpy02.jpg> An efficient program setup
<https://i.postimg.cc/N0G1TXcZ/scrcpy01.jpg> Mirror Android on any PC

In summary, with this set of solutions, anyone can instantly mirror
their Android phone on their PC (Windows, linux, or macOS) with a
shortcut (or Win+R command) without having to deal with the scrcpy
console window popping up and getting into the way of their nice setup!

Thanks for me and for the permanent Usenet record for others to benefit.
<http://groups.google.com/g/alt.msdos.bat>
<http://groups.google.com/g/alt.comp.microsoft.windows>

Specifically:
<https://groups.google.com/g/alt.msdos.batch/c/DmexCLwn_tM>
<https://groups.google.com/g/alt.comp.microsoft.windows/c/eMYBmpq2H50>

Note "alt.comp.os.windows-10" is poorly archived so it's not listed above.
--
Usenet is a world-wide team sport where purposefully helpful kind-hearted
adults help each other and learn by pooling our individual capabilities.

Pages:12
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor