小编Dog*_*ggo的帖子

CSS颜色与背景颜色与背景颜色?

在HTML中我什么时候使用颜色,背景颜色和背景标签之间有什么区别?

有什么区别?

html css css3

40
推荐指数
6
解决办法
3万
查看次数

解析通过JavaScript从AJAX请求获得的JSON响应

我正在通过JavaScript为AJAX请求提供JSON响应.

以下是回复:

{"responseCode":400,"errors":false,"submitted":false,"content":"some content","notice":""}
Run Code Online (Sandbox Code Playgroud)

我的目标是获取内容:

"some content"
Run Code Online (Sandbox Code Playgroud)

json变量就是我的数据.所以,我尝试过:

data.content
Run Code Online (Sandbox Code Playgroud)

但我正在设置一个空字符串.

有关如何访问字符串的任何想法?

先感谢您.

javascript ajax json

16
推荐指数
1
解决办法
5万
查看次数

Powershell 测试路径输出 -eq "False" 不起作用

所以我试图检查路径是否可用。我用测试路径做这个

它看起来像这样:

$c="C:\"
$d="D:\"
$e="E:\"

if(Test-Path $c -eq "False"){
}
elseif(Test-Path $d -eq "False"){
}
elseif(Test-Path $e -eq "False"){
}
else{
"The File doesn't exist"
}
Run Code Online (Sandbox Code Playgroud)

那么如果错误看起来像这样,我做错了什么:

Test-Path : A parameter cannot be found that matches parameter name 'eq'.
At C:\Users\boriv\Desktop\ps\Unbenannt1.ps1:23 char:17
+ If(Test-Path $c -eq "False"){
+                 ~~~
+ CategoryInfo          : InvalidArgument: (:) [Test-Path], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.TestPathCommand`
Run Code Online (Sandbox Code Playgroud)

powershell path

2
推荐指数
1
解决办法
9104
查看次数

一个简单的尝试捕获不起作用Powershell

所以我正在用Powershell做一个robocopy.我只想写一个日志文件.Robocopy工作,但尝试和捕获不起作用.这是我的Powershell代码:

function Write-Log{[CmdletBinding()]
Param(
[Parameter(Mandatory=$False)]
[ValidateSet("INFO","WARN","ERROR","FATAL","DEBUG")]
[String]
$level = "INFO",

[Parameter(Mandatory=$True)]
[string]
$message ,

[Parameter(Mandatory=$True)]
[string]
$logfile
)

$timeStamp = (Get-Date).toString("dd.MM.yyyy HH:mm:ss")
$line = "$timeStamp $level $message"
if($logfile) {
    Add-Content $logfile -Value $line
} else {
    Write-Output $line
}}


try {C:\WINDOWS\SysWOW64\robocopy.exe "C:\Users\boriv\Desktop\por" "C:/users/boriv/desktop/1" robocopy *.* /MIR /EFSRAW /DCOPY:DAT /A+:R /A-:AE /IA:ACEHNORST /V /BYTES}

catch { Write-Log -message "Der Kopiervorgang war nicht erfolgreich" -logfile "C:\users\boriv\Desktop\$(get-date -f dd-MM-yyyy).txt" -level ERROR}

Write-Log -message "Der Kopiervorgang war erfolgreich" -logfile "C:\users\boriv\Desktop\$(get-date -f dd-MM-yyyy).txt" -level INFO
Run Code Online (Sandbox Code Playgroud)

powershell try-catch

1
推荐指数
1
解决办法
599
查看次数

标签 统计

powershell ×2

ajax ×1

css ×1

css3 ×1

html ×1

javascript ×1

json ×1

path ×1

try-catch ×1