如何在windows中运行'source ~/.my_commands.sh'?

How to run 'source ~/.my_commands.sh' in windows?

我想 运行 source ~/.my_commands.sh 但我做不到。我已经尝试过 PowerShell 和 CommandPrompt 这些是我得到的错误。如果在windows中无法运行此命令,是否有替代解决方案?:

PowerShell:

命令提示符:

这是 my_commands.sh 包含的内容:

#!/bin/bash

function create() {
    cd
    source .env
    python create.py 
    cd $FILEPATH
    git init
    git remote add origin git@github.com:$USERNAME/.git
    touch README.md
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    code .
}

在 windows 上 运行 .sh 脚本的一种简单方法是使用 git bash。下载并安装 git for windows,转到包含 .sh 脚本的文件夹,右键单击,select“git bash 此处”和 运行 脚本像这样:

./my_commands.sh