简体   繁体   English

如何在 Windows 启动时运行 git bash 脚本

[英]How to run git bash scripts on windows startup

I've created a shell script and for execute it I need to use GIT BASH with this command我已经创建了一个 shell 脚本,为了执行它,我需要在这个命令中使用GIT BASH

sh scriptname.sh

It's possible execute this command on GIT BASH when windows startup automatically? windows自动启动时可以在GIT BASH上执行这个命令吗?

In Windows 10:在 Windows 10 中:

1) Create a regular, plain text file named myscript.txt , for example. 1) 例如,创建一个名为myscript.txt的常规纯文本文件。

2) As its contents, insert this: sh scriptname.sh . 2) 作为其内容,插入: sh scriptname.sh Save and close.保存并关闭。

3) Rename this file to myscript.bat then, with your Windows Explorer, locate the file at the filesystem folder, right click on it and select " copy ". 3) 将此文件重命名为myscript.bat然后使用 Windows 资源管理器在文件系统文件夹中找到该文件,右键单击它并选择“复制”。

4) Yet on Windows Explorer, go to <ROOT>\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp and right click on it. 4) 然而在 Windows 资源管理器上,转到<ROOT>\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp并右键单击它。 Then select " paste shortcut " (you will need Administration rights to do it).然后选择“粘贴快捷方式”(您需要管理权限才能执行此操作)。

It's done.完成。 Every time your windows starts it runs your bash.每次您的 Windows 启动时,它都会运行您的 bash。

More info: https://support.microsoft.com/en-us/help/4026268/windows-10-change-startup-apps更多信息: https : //support.microsoft.com/en-us/help/4026268/windows-10-change-startup-apps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM