WSL Ubuntu, is there an easy way to have bash start automatically on Windows startup?

PF92

I have a question about the WSL version of Ubuntu. Is there an easy way to have bash start automatically when Windows starts and pass a command to it to start the SSH server? So that the SSH server runs all the time when Windows runs.

Cornea Valentin

(( update this works on WSL 2))

Solution 1 use VBE script.

Click on Start and search for shell:startup. also you can go manually to:

C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

now create a new file sshserver.vbe and add this text and save

Set ws = CreateObject("Wscript.Shell") 
ws.run "wsl -d Ubuntu -u root service ssh start", vbhide

Solution 2 It's Task Scheduler

Click on Start and search for Task Scheduler.

On Task Scheduler click on Action and select Create Basic Task enter image description here

On Create Basic Task Fill out Name and Description "Auto Start SSH server"

create Basic Task

On Trigger select: When the computer starts.

Trigger

On Action select Start a program

Action

On Start a Program type path: C:\Windows\System32\wsl.exe, next on add Add arguments (optional): -d Ubuntu -u root service ssh start.

Start a Program

You should have something like this on the last step.

finish

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to specify startup directory for WSL (Ubuntu) in ConEmu in Windows 10

From Dev

Communication between Ubuntu on WSL2 and Windows is spotty after startup

From Dev

Is there an easy way to have the copyright notice automatically added by android studio?

From Dev

How to automatically start Kafka upon system startup in Ubuntu?

From Dev

Bash - easy way to compare strings which have different delimiters?

From Dev

What is the easy way to start Task Manager as an administrator in Windows 8?

From Dev

Can I change directory to a Windows drive in Ubuntu Bash on WSL?

From Dev

How can I run a Windows executable from WSL (Ubuntu) Bash

From Dev

Can I change directory to a Windows drive in Ubuntu Bash on WSL?

From Dev

How can I run a Windows executable from WSL (Ubuntu) Bash

From Dev

Visual Studio Code and Bash on Ubuntu on Windows (WSL) GCC/GDB integration

From Dev

UWP app start automatically at startup

From Dev

Automatically start VNC server on startup

From Dev

How to start Skype from command line in windows 10 or start it at startup automatically?

From Dev

is there a way to have bash variable automatically updated upon calling?

From Dev

Best way to start Zookeeper automatically on Ubuntu Server 14.04?

From Dev

Run task in Windows on WSL2 startup

From Dev

automatically login to windows after startup

From Dev

Which is a best practice to start programs automatically in windows, Common startup group or Registry?

From Dev

Which is a best practice to start programs automatically in windows, Common startup group or Registry?

From Dev

An efficient way to start a graphical application with multiple monitors with WSL2 and VcXsrv on Windows

From Dev

Can I drag and drop files to an .sh script using Bash on Ubuntu on Windows or Windows Subsystem for Linux (WSL)?

From Dev

Start thinking sphinx on Ubuntu startup

From Dev

Start service autamatically on startup at Ubuntu

From Dev

Easy way to "inherit" Bash completion

From Dev

Start Quarz Scheduler automatically at startup of Tomcat

From Dev

If I have windows on hibernate, and I start ubuntu, will my computer lag?

From Dev

If I have windows on hibernate, and I start ubuntu, will my computer lag?

From Dev

Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?

Related Related

  1. 1

    How to specify startup directory for WSL (Ubuntu) in ConEmu in Windows 10

  2. 2

    Communication between Ubuntu on WSL2 and Windows is spotty after startup

  3. 3

    Is there an easy way to have the copyright notice automatically added by android studio?

  4. 4

    How to automatically start Kafka upon system startup in Ubuntu?

  5. 5

    Bash - easy way to compare strings which have different delimiters?

  6. 6

    What is the easy way to start Task Manager as an administrator in Windows 8?

  7. 7

    Can I change directory to a Windows drive in Ubuntu Bash on WSL?

  8. 8

    How can I run a Windows executable from WSL (Ubuntu) Bash

  9. 9

    Can I change directory to a Windows drive in Ubuntu Bash on WSL?

  10. 10

    How can I run a Windows executable from WSL (Ubuntu) Bash

  11. 11

    Visual Studio Code and Bash on Ubuntu on Windows (WSL) GCC/GDB integration

  12. 12

    UWP app start automatically at startup

  13. 13

    Automatically start VNC server on startup

  14. 14

    How to start Skype from command line in windows 10 or start it at startup automatically?

  15. 15

    is there a way to have bash variable automatically updated upon calling?

  16. 16

    Best way to start Zookeeper automatically on Ubuntu Server 14.04?

  17. 17

    Run task in Windows on WSL2 startup

  18. 18

    automatically login to windows after startup

  19. 19

    Which is a best practice to start programs automatically in windows, Common startup group or Registry?

  20. 20

    Which is a best practice to start programs automatically in windows, Common startup group or Registry?

  21. 21

    An efficient way to start a graphical application with multiple monitors with WSL2 and VcXsrv on Windows

  22. 22

    Can I drag and drop files to an .sh script using Bash on Ubuntu on Windows or Windows Subsystem for Linux (WSL)?

  23. 23

    Start thinking sphinx on Ubuntu startup

  24. 24

    Start service autamatically on startup at Ubuntu

  25. 25

    Easy way to "inherit" Bash completion

  26. 26

    Start Quarz Scheduler automatically at startup of Tomcat

  27. 27

    If I have windows on hibernate, and I start ubuntu, will my computer lag?

  28. 28

    If I have windows on hibernate, and I start ubuntu, will my computer lag?

  29. 29

    Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?

HotTag

Archive