只是一个简单的问题。我试图从vbs执行以下cmd命令:
mklink /j "%userprofile%\AppData\Roaming\FIEBIG\bin" "%Programfiles(x86)%\fiebig-team\fticclient\bin"
使用以下代码:
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd.exe mklink /j ""%userprofile%\AppData\Roaming\FIEBIG\bin"" ""Programfiles(x86)%\fiebig-team\fticclient\bin"" "
但是,无论我尝试添加或排除引号,它仍然无法正常工作。
你能帮忙解决这个问题, 干杯
答案 0 :(得分:0)
您不需要CMD.EXE
,是吗?
strCommand = "mklink /j"
strCommand = strCommand & " "
strCommand = strCommand & Chr(34) & "%userprofile%\AppData\Roaming\FIEBIG\bin" & Chr(34)
strCommand = strCommand & " "
strCommand = strCommand & Chr(34) & "%Programfiles(x86)%\fiebig-team\fticclient\bin" & Chr(34)
objShell.Run strCommand
顺便说一句,这是我用来确保获得正确命令行的调试技巧。使用InputBox()
并将命令字符串作为第3个参数传递。这允许您将其复制并粘贴到命令提示符窗口。
InputBox "", "", strCommand
答案 1 :(得分:0)
非常感谢你的帮助。我真的很喜欢软件包装,只是开始编码。那对你来说怎么样?
Set objShell = WScript.CreateObject ("WScript.Shell")
objShell.run
strCommand = "mklink /j"
strCommand = strCommand & " "
strCommand = strCommand & Chr(34) & "%userprofile%\AppData\Roaming\FIEBIG\bin" & Chr(34)
strCommand = strCommand & " "
strCommand = strCommand & Chr(34) & "%Programfiles(x86)%\fiebig-team\fticclient\bin" & Chr(34)
objShell.Run strCommand