Hide cloudflared.exe output?

I use a .bat to make it easier for my users to connect to RDP through a tunnel:

echo @off
set /a portlocal=%random% %%32767 +20000
start /min cmd /c "C:\Program Files (x86)\cloudflared\cloudflared.exe" access rdp --hostname foo.foo.com --url localhost:%portlocal% > a.txt 2>&1
start mstsc.exe -v localhost:%portlocal%

Is there any way to hide the output of cloudflared.exe in access mode?

image

It is very annoying for users to see a shell with things they don’t understand.

Sounds like you want to add --loglevel error (or even “fatal”) to your cloudflared access command.

With --loglevel error no messages are displayed, but the user still sees a black window (shell) that fails if closed.

So you want to start a command without having the shell at all. Basically starting it in the background?

An equivalent to

command &

on linux?

If so, please try to start it like this:

start /B ""

In your case should look something like this:

start /B "Cloudflare" cmd /c "C:\Program Files (x86)\cloudflared\cloudflared.exe" access rdp --hostname foo.foo.com --url localhost:%portlocal% > a.txt 2>&1

This should start a new CMD process in the background without any new CMD/Shell window which is named “Cloudflare”, so you will still be able to find it in the taskmanager.

For more info, please run:

HELP START

which shows you all possible parameters etc.

Another option is to install Windows own SSH Server (musst be installed seperately) and run the command through it, like this:

ssh [email protected] "command to start"

This will also survive the closing of the parent CMD/Shell

This is untested tho

Yes, like linux does with command &

I have tried

 start /B "Cloudflare" cmd /c "C:\Program Files (x86)\cloudflared\cloudflared.exe" access rdp --hostname foo.foo.com --url localhost:59315 --loglevel fatal

but it does not work as in Linux, the process remains in background as long as the CMD window is not closed.

If you launch it in a shortcut, cloudflared.exe opens and closes immediately, giving localhost:59315 as unreachable.

Ideally, cloudflared.exe would support that option with a service, or have an agent like WARP in the task bar.

That is a pitty.
I just see two options as for now.

  1. SSH Server
  2. maybe give Hidden Start/hstart a try

You can open that feature request.

Thanks, I will try hidden start, I didn’t know it.

Yes, I will do it.