什么是@”运算符?
What is @” operator?
我在互联网上搜索了这意味着什么:@”
,包括 @
和 ”
。
这是在这个 code:
$Win32ShowWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
我也不断收到上面第一行的错误消息:
White space is not allowed before the string terminator.
我将 ”
更改为 "
,但没有成功。
那么这些符号在 Powershell 中是什么意思?
谢谢
您正在查看 here-string。错误来自格式错误的此处字符串。
上面的代码可以复制并按原样工作。开始必须结束该行,此处字符串的结尾必须单独在它自己的行上。它们在您的代码中有哪些问题。我可以通过在终止符 "@
之前添加一些空格来创建您的错误。
$Win32ShowWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
我会仔细检查您实际使用的代码。猜测您会发现前导空格,就像错误提示的那样。您链接到的页面中有一条评论谈到从代码中删除该空格。您从具有前导空格的站点复制并粘贴。
中提取一行
A here-string is used to embed large chunks of text inline in a script into a single string literal. This is very similar to a feature in C#, but the difference is that in PowerShell the here-string begins at the end of a line and the terminating sequence must be at the beginning of a line.
使用双引号可以扩展变量,而单引号则不行。就像 PowerShell 中的普通字符串一样。
我也看到智能引号,但正如您所说,当您更改它们时没有帮助。一般来说,请留意那些。
我在互联网上搜索了这意味着什么:@”
,包括 @
和 ”
。
这是在这个 code:
$Win32ShowWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
我也不断收到上面第一行的错误消息:
White space is not allowed before the string terminator.
我将 ”
更改为 "
,但没有成功。
那么这些符号在 Powershell 中是什么意思?
谢谢
您正在查看 here-string。错误来自格式错误的此处字符串。
上面的代码可以复制并按原样工作。开始必须结束该行,此处字符串的结尾必须单独在它自己的行上。它们在您的代码中有哪些问题。我可以通过在终止符 "@
之前添加一些空格来创建您的错误。
$Win32ShowWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
我会仔细检查您实际使用的代码。猜测您会发现前导空格,就像错误提示的那样。您链接到的页面中有一条评论谈到从代码中删除该空格。您从具有前导空格的站点复制并粘贴。
中提取一行A here-string is used to embed large chunks of text inline in a script into a single string literal. This is very similar to a feature in C#, but the difference is that in PowerShell the here-string begins at the end of a line and the terminating sequence must be at the beginning of a line.
使用双引号可以扩展变量,而单引号则不行。就像 PowerShell 中的普通字符串一样。
我也看到智能引号,但正如您所说,当您更改它们时没有帮助。一般来说,请留意那些。