[GH-ISSUE #284] Options for hiding and awaiting termination of the app started before a RDP connection #249

Closed
opened 2026-02-26 11:57:24 +03:00 by kerem · 14 comments
Owner

Originally created by @bug-ware on GitHub (Sep 6, 2022).
Original GitHub issue: https://github.com/1Remote/1Remote/issues/284

Originally assigned to: @VShawn on GitHub.

Is your feature request related to a problem? Please describe.
I use the start App before (German App vorher starten) connecting to a RDP session. Two things are annoying:

  1. A cmd window pops up which doesn't show anything.
  2. The RDP connection does not wait.

Describe the solution you'd like
Regarding 1) Could you please add an option to start the App in hidden mode? See SW_HIDE, e.g., in ShowWindow function of Windows API.
Regarding 2) Please add an option to wait for the App process to end or alternatively add an option for a delay to be entered and that is waited for before starting the RDP connection.

Hope this make sense. Thanks a lot for developing this App!

goal:

  • wait for the script process to end then start the session
  • add an option to hide the scrip cmd window
Originally created by @bug-ware on GitHub (Sep 6, 2022). Original GitHub issue: https://github.com/1Remote/1Remote/issues/284 Originally assigned to: @VShawn on GitHub. **Is your feature request related to a problem? Please describe.** I use the start App before (German App vorher starten) connecting to a RDP session. Two things are annoying: 1. A cmd window pops up which doesn't show anything. 2. The RDP connection does not wait. **Describe the solution you'd like** Regarding 1) Could you please add an option to start the App in hidden mode? See SW_HIDE, e.g., in ShowWindow function of Windows API. Regarding 2) Please add an option to wait for the App process to end or alternatively add an option for a delay to be entered and that is waited for before starting the RDP connection. Hope this make sense. Thanks a lot for developing this App! goal: - [x] wait for the script process to end then start the session - [x] add an option to hide the scrip cmd window
kerem 2026-02-26 11:57:24 +03:00
Author
Owner

@VShawn commented on GitHub (Sep 8, 2022):

Definitely a BUG it is, I did not design any cmd window pops up.

<!-- gh-comment-id:1240282603 --> @VShawn commented on GitHub (Sep 8, 2022): Definitely a BUG it is, I did not design any `cmd window pops up`.
Author
Owner

@VShawn commented on GitHub (Sep 8, 2022):

Ohhhh...

Do you make use of Before cmd feature? It may bring us a cmd pop window.

image

<!-- gh-comment-id:1240283633 --> @VShawn commented on GitHub (Sep 8, 2022): Ohhhh... Do you make use of `Before cmd` feature? It may bring us a cmd pop window. ![image](https://user-images.githubusercontent.com/10143738/189050966-fa621a38-ff11-4ebc-b28a-f436919e1e0b.png)
Author
Owner

@bug-ware commented on GitHub (Sep 9, 2022):

Yes, exactly; I have the German translation. ;o)

The window doesn't show anything. It is just black. So one could optionally hide it in those cases.

I use this feature to run a script that initiates a ssh connection with tunneling of the rdp port. The "After cmd" script kill this connection afterwards.
This connection is why I would like the RDP connection to wait until the cmd returns. Otherwise the tunnel is not yet ready. Maybe there is a more elegant solution. Unfortunately, there is no VPN available.

<!-- gh-comment-id:1241883337 --> @bug-ware commented on GitHub (Sep 9, 2022): Yes, exactly; I have the German translation. ;o) The window doesn't show anything. It is just black. So one could optionally hide it in those cases. I use this feature to run a script that initiates a ssh connection with tunneling of the rdp port. The "After cmd" script kill this connection afterwards. This connection is why I would like the RDP connection to wait until the cmd returns. Otherwise the tunnel is not yet ready. Maybe there is a more elegant solution. Unfortunately, there is no VPN available.
Author
Owner

@VShawn commented on GitHub (Sep 10, 2022):

Ok, it make sense, I will firstly try to add a feature to wait script end before it start a RDP session. Then find out how to hide the cmd window.

<!-- gh-comment-id:1242588939 --> @VShawn commented on GitHub (Sep 10, 2022): Ok, it make sense, I will firstly try to add a feature to wait script end before it start a RDP session. Then find out how to hide the cmd window.
Author
Owner

@VShawn commented on GitHub (Sep 10, 2022):

https://github.com/VShawn/Shawn.Utils/blob/master/Shawn.Utils.Wpf/WinCmdRunner.cs#L44-L63
image

I found that it has already hide the cmd window in the PRemoteM.

It works on my PC. Maybe some policy on your PC makes it malfunction

<!-- gh-comment-id:1242597688 --> @VShawn commented on GitHub (Sep 10, 2022): https://github.com/VShawn/Shawn.Utils/blob/master/Shawn.Utils.Wpf/WinCmdRunner.cs#L44-L63 ![image](https://user-images.githubusercontent.com/10143738/189465041-a4e2cd20-79cd-4715-b5a1-1b88886531ce.png) I found that it has already hide the cmd window in the PRemoteM. It works on my PC. Maybe some policy on your PC makes it malfunction
Author
Owner

@VShawn commented on GitHub (Sep 10, 2022):

PRemoteM.0.7.1.6.Alpha2-x86-Net6.zip

image

I made this early preview version which will:

  1. support run a script file (.bat|.ps1|*.py)
  2. show cmd window when run the script
  3. connection will wait until the cmd returns (until the cmd window close by itself)
  4. and yes, in this early preview, run a script will stuck our UI, this will be fixed in the latter develop for UX improve.

Can you help me test this function?

I will make the feature a better UX if this above achieve our goal :)

<!-- gh-comment-id:1242671442 --> @VShawn commented on GitHub (Sep 10, 2022): [PRemoteM.0.7.1.6.Alpha2-x86-Net6.zip](https://github.com/1Remote/PRemoteM/files/9539856/PRemoteM.0.7.1.6.Alpha2-x86-Net6.zip) ![image](https://user-images.githubusercontent.com/10143738/189476130-535b2e1a-8553-43f2-b9cf-a503462ab0f5.png) I made this early preview version which will: 1. support run a script file (*.bat|*.ps1|*.py) 2. show cmd window when run the script 3. connection will wait until the cmd returns (until the cmd window close by itself) 4. and yes, in this early preview, run a script will stuck our UI, this will be fixed in the latter develop for UX improve. Can you help me test this function? I will make the feature a better UX if this above achieve our goal :)
Author
Owner

@VShawn commented on GitHub (Sep 11, 2022):

PRemoteM.0.7.1.6.Alpha3-x86-Net6.zip

now an option for hide the script window has been added, and the stuck of the main window has been fixed.

I think this ticket is done :)

<!-- gh-comment-id:1242888857 --> @VShawn commented on GitHub (Sep 11, 2022): [PRemoteM.0.7.1.6.Alpha3-x86-Net6.zip](https://github.com/1Remote/PRemoteM/files/9541837/PRemoteM.0.7.1.6.Alpha3-x86-Net6.zip) now an option for hide the script window has been added, and the stuck of the main window has been fixed. I think this ticket is done :)
Author
Owner

@bug-ware commented on GitHub (Sep 12, 2022):

Hello.
My script uses some arguments. This was fine before but now gives an error that the file cannot be found.
I also noticed that one cannot search for ".cmd" files which are almost equivalent with ".bat"

<!-- gh-comment-id:1244158472 --> @bug-ware commented on GitHub (Sep 12, 2022): Hello. My script uses some arguments. This was fine before but now gives an error that the file cannot be found. I also noticed that one cannot search for "*.cmd" files which are almost equivalent with "*.bat"
Author
Owner

@VShawn commented on GitHub (Sep 13, 2022):

Yes, in the old approach, I run a scrip by open cmd.exe then run script in the cmd.exe.

In this approach I can not track the scrip processing procedure, that is to say I don't know when the script process to end. Besides I found that the cmd process sometimes would not be kill after the script run to end in the old approach。

So in this new one, I run the script file directly to achieve the script process tracking.

Then I usually write arguments in the script files, so I don't consider of the parameters pass...

<!-- gh-comment-id:1244804169 --> @VShawn commented on GitHub (Sep 13, 2022): Yes, in the old approach, I run a scrip by open cmd.exe then run script in the cmd.exe. In this approach I can not track the scrip processing procedure, that is to say I don't know when the script process to end. Besides I found that the cmd process sometimes would not be kill after the script run to end in the old approach。 So in this new one, I run the script file directly to achieve the script process tracking. Then I usually write arguments in the script files, so I don't consider of the parameters pass...
Author
Owner

@VShawn commented on GitHub (Sep 13, 2022):

I make some improvement to make app recognize the parameters.

image

image

PRemoteM.0.7.1.6.Alpha4-x86-Net6.zip

<!-- gh-comment-id:1244811453 --> @VShawn commented on GitHub (Sep 13, 2022): I make some improvement to make app recognize the parameters. ![image](https://user-images.githubusercontent.com/10143738/189791610-2186b6cc-f1a6-40b4-ab33-cd0a2aec8420.png) ![image](https://user-images.githubusercontent.com/10143738/189791967-b85e788e-d577-4e04-8e77-d6c02b3a875f.png) [PRemoteM.0.7.1.6.Alpha4-x86-Net6.zip](https://github.com/1Remote/PRemoteM/files/9552982/PRemoteM.0.7.1.6.Alpha4-x86-Net6.zip)
Author
Owner

@bug-ware commented on GitHub (Sep 13, 2022):

Thanks. The parameters are recognized now. If I click on "Prüfen" (I guess test or check in English) everything works fine. The script is run and the GUI seems to know if it is finished or not.
However when I start the RDP connection nothing happens. I.e., it seems that no script is startet. Such, the connection times out with an error. I checked with netstat and found the tunnel port is not opened. Also ssh is not in the task list.
Could you transfer the test routine to the actual connection routine? (Without the MsgBox of course ;o)

<!-- gh-comment-id:1245814688 --> @bug-ware commented on GitHub (Sep 13, 2022): Thanks. The parameters are recognized now. If I click on "Prüfen" (I guess test or check in English) everything works fine. The script is run and the GUI seems to know if it is finished or not. However when I start the RDP connection nothing happens. I.e., it seems that no script is startet. Such, the connection times out with an error. I checked with netstat and found the tunnel port is not opened. Also ssh is not in the task list. Could you transfer the test routine to the actual connection routine? (Without the MsgBox of course ;o)
Author
Owner

@majkinetor commented on GitHub (Sep 13, 2022):

D:\test - 2.bat -t abc looks totally funky.

You probably shouldnt' do that but work with quotes with spaces in names. This is how Explorer handles it with long names:

image

image

<!-- gh-comment-id:1245821533 --> @majkinetor commented on GitHub (Sep 13, 2022): `D:\test - 2.bat -t abc` looks totally funky. You probably shouldnt' do that but work with quotes with spaces in names. This is how Explorer handles it with long names: ![image](https://user-images.githubusercontent.com/85767/189984665-3efee73c-4417-4f50-bf38-7bd73f8f152d.png) ![image](https://user-images.githubusercontent.com/85767/189984723-86f30a0f-7852-41c9-8bb9-30faf481a138.png)
Author
Owner

@VShawn commented on GitHub (Sep 14, 2022):

@majkinetor

D:\test - 2.bat -t abc looks totally funky.

Ahaha, I knew it. This should be "D:\test - 2.bat" in Windows.

But this place can be edit by user, I concerned that someone write something without quotes.

So I add this test case and cheek if the quotes can be add by my code.

image

Works too:
image

@bug-ware

However when I start the RDP connection nothing happens. I.e., it seems that no script is startet. Could you transfer the test routine to the actual connection routine?

sure thing :)

PRemoteM.0.7.1.6.Alpha5-x86-Net6.zip

<!-- gh-comment-id:1246160987 --> @VShawn commented on GitHub (Sep 14, 2022): @majkinetor > D:\test - 2.bat -t abc looks totally funky. Ahaha, I knew it. This should be "D:\test - 2.bat" in Windows. But this place can be edit by user, I concerned that someone write something without quotes. So I add this test case and cheek if the quotes can be add by my code. ![image](https://user-images.githubusercontent.com/10143738/190043211-13fabd3a-5943-4537-bfc5-7f674bfe35e0.png) Works too: ![image](https://user-images.githubusercontent.com/10143738/190046373-fd2adb17-0e59-41cd-a560-1fe25adeffac.png) @bug-ware > However when I start the RDP connection nothing happens. I.e., it seems that no script is startet. Could you transfer the test routine to the actual connection routine? sure thing :) [PRemoteM.0.7.1.6.Alpha5-x86-Net6.zip](https://github.com/1Remote/PRemoteM/files/9562186/PRemoteM.0.7.1.6.Alpha5-x86-Net6.zip)
Author
Owner

@bug-ware commented on GitHub (Sep 14, 2022):

sure thing :)

Works like a charm so far!
Thanks a lot! This makes my RDP really remote when working from home ;o)

<!-- gh-comment-id:1246313986 --> @bug-ware commented on GitHub (Sep 14, 2022): > sure thing :) Works like a charm so far! Thanks a lot! This makes my RDP really remote when working from home ;o)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/1Remote#249
No description provided.