将多个变量的内容从excelshell命令传递到bash脚本

将多个变量的内容从excelshell命令传递到bash脚本,excel,bash,Excel,Bash,试图通过VBA shell命令将字符串名称的内容传递给Bash脚本,但它显示的是字符串名称而不是字符串的内容 From Excel VBA Dim Str1 As String Dim Str2 As String Str1 = "AAAAAAAAA" Str2 = "BBBBBBBBB" BASHPATH = "C:\Windows\Sysnative\bash" ' or C:\Windows\SysWOW64\bash" WORK_DIRECTORY = "/mnt/c/Work/"

试图通过VBA shell命令将字符串名称的内容传递给Bash脚本,但它显示的是字符串名称而不是字符串的内容

From Excel VBA

Dim Str1 As String
Dim Str2 As String

Str1 = "AAAAAAAAA"
Str2 = "BBBBBBBBB"

BASHPATH = "C:\Windows\Sysnative\bash" ' or C:\Windows\SysWOW64\bash"
WORK_DIRECTORY = "/mnt/c/Work/"
SCRIPT = "bashscript.sh Str1 Str2"

Call Shell(BASHPATH + " " + WORK_DIRECTORY + SCRIPT, 1) 
从basscript.sh

'Run code below 
echo "$1"
echo "$2"

'When you run the code above it shows:
Str1
Str2

'instead of:
AAAAAAAAAA
BBBBBBBBBB

您没有替换字符串中的变量

使用以下命令更新VBA脚本

SCRIPT = "bashscript.sh " & Str1 & " " & Str2