chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.44k stars 135 forks source link

How to remove startup messages from CMD and Clink? #646

Closed Mvkbesteu closed 1 month ago

Mvkbesteu commented 1 month ago

hi so i've got a question, could i somehow remove those lines at the startup of clink & cmd? so i can keep it more clean?

image

chrisant996 commented 1 month ago

The "Microsoft Windows" message is not coming from Clink, it's coming from CMD. There isn't a way to tell CMD to always automatically suppress it, but the cmd /k flag suppresses it in an individual CMD invocation. Or you could add a startup script to run cls to clear the screen as part of Clink startup.

The copyright message question is covered in #622, #601, #594, #538, #458, #264, or #104.

A good place to start for getting to know Clink and some common configuration is Getting Started.

I've added a new section Startup Message in the Common Configuration section of the documentation.

Mvkbesteu commented 1 month ago

I tried using $$cls at the end of the regkey and even make the terminal open a .bat that clears everything up and starts empty but both break clink for some reason or atleast not clink, but clink and starship it messes with the whole shell is not a starship problem though tried it without it.

chrisant996 commented 1 month ago

I tried using $$cls at the end of the regkey and even make the terminal open a .bat that clears everything up and starts empty but both break clink for some reason or atleast not clink, but clink and starship it messes with the whole shell is not a starship problem though tried it without it.

A few things:

I suggested using a startup script (read the docs at the link) and having the script run cls inside it. That definitely works.

naxl commented 1 month ago

I tried using $$cls at the end of the regkey and even make the terminal open a .bat that clears everything up and starts empty but both break clink for some reason or atleast not clink, but clink and starship it messes with the whole shell is not a starship problem though tried it without it.

I believe I can share a workaround that has worked well for me. To adjust the Command Prompt shortcut, which can be found in one of the folders under C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs, you can modify the target to %windir%\system32\cmd.exe /k cls.

For adding an entry to the context menu for folders, you can edit the relevant registry key to use the following command as the program to open: C:\Windows\System32\cmd.exe /s /k pushd %V && cls. This will allow you to right-click and open the Command Prompt with your desired arguments.

Also keep in mind the warnings from @chrisant996 in #646 : 5 !

neradp commented 1 month ago

Hi, my autorun reg key: "C:\Program Files (x86)\clink\clink.bat" inject --autorun --quiet --profile ~\clink clink.bat already calls cmd with \k switch: start "Clink" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg%%clink_quiet_arg%" I set up default terminal app for windows : windows terminal My cmd window could be clean, but Im using the version info shortened by me:

Microsoft Windows [Version 10.0.22631.3880] powered by Clink 1.6.20.00f214

In my start up script im using:

FOR /F "tokens=* USEBACKQ" %%F IN (`ver`) DO (
SET version=%%F
)

FOR /F "tokens=* USEBACKQ" %%F IN (`"C:\Program Files (x86)\clink\clink.bat" --version`) DO (
SET cversion=%%F
)

echo %version% powered by Clink %cversion%