gpt4 book ai didi

powershell - 格式化字符串 : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. 时出错。在这里字符串

转载 作者:行者123 更新时间:2023-12-03 00:36:08 25 4
gpt4 key购买 nike

我正在使用 Powershell here-strings 格式化 HTML 正文,但出现以下错误:

Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..

代码如下:

$my_html = @"
<html>
<head></head>
<body>
<p>You have been invited to the following SharePoint site:</p><a href={0}>{1}</a>
<p>If you are not sure what your username is, please find it at</p>' + '<a href="https://outside.arup.com/default.aspx">here</a>
<p>Your username is {3}</p><p>Your password is: {4}</p>
<p>Please note that for any support queries, please contact your Arup site owner or Global IT (Applications).</p>
</body>
</html>
"@ -f $url, $siteTitle, $username, $password

所有参数都已初始化,并且只是标准字符串。我错过了什么?

谢谢

最佳答案

看起来您在 -f 的右侧传递了 4 个参数PowerShell 运算符。在您的源字符串中,您有 {0} 的占位符{1} {3}{4} .您需要更改 {3}{2}并更改 {4}{3} .

关于powershell - 格式化字符串 : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. 时出错。在这里字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39500580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com