我在Windows 7上安装了bonobo git服务器.
我通过这个倭黑猩猩创建了一个新的存储库"SFK".
然后我克隆成那样:
git clone http://localhost/Bonobo.Git.Server/SFK.git
git add "trans.cs"
git commit -m "added"
git push http://localhost/Bonobo.Git.Server/SFK.git
Run Code Online (Sandbox Code Playgroud)
一切正常.
当我试图拉动使用时
git pull http://localhost/Bonobo.Git.Server/SFK.git
Run Code Online (Sandbox Code Playgroud)
它给出了这个错误
fatal:
Couldn't find remote ref HE
Unexpected end of command stream
Run Code Online (Sandbox Code Playgroud)
我哪里错了?我是这个git和bonobo的新手.请建议如何纠正这个问题.
更新:
推后我试过这个.
git config --global pull.default current
git config --global push.default current
Run Code Online (Sandbox Code Playgroud)
有效.
在PowerShell 5.1中创建相对符号链接并不是那么简单.New-Item没有按预期工作.下面列出了一些方法.我错过了什么吗?
所有示例的示例设置:
mkdir C:\Temp\foo -ErrorAction SilentlyContinue
'sample contents' > C:\Temp\foo\foo.txt
cd C:\Temp
Run Code Online (Sandbox Code Playgroud)
Sample1:不能按预期工作
#new ps5 Item cmdlets (https://msdn.microsoft.com/en-us/powershell/wmf/5.0/feedback_symbolic) are not working well with relative paths
#C:\Temp\foo and C:\Temp\foo\foo.txt are returned
$fld = New-Item -ItemType SymbolicLink -Name 'bar' -Target '.\foo'
$fl = New-Item -ItemType SymbolicLink -Name 'bar.txt' -Target '.\foo\foo.txt'
$fld.Target
$fl.Target
Run Code Online (Sandbox Code Playgroud)
Sample2:不能按预期工作
#Powershell community extensions
#same problem - paths are created as absolute: C:\Temp\foo C:\Temp\foo\foo.txt
$fld = New-Symlink 'c:\Temp\bar' '.\foo'
$fl = …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 PowerShell 脚本来在 IIS 中托管一个网站。
我在没有安装 IIS 的机器上尝试了这个脚本,但出现错误,所以我想检查是否安装了 IIS,然后我想在 ISS 中托管一个网站。
下面是我正在尝试的脚本,但它不起作用:
$vm = "localhost";
$iis = Get-WmiObject Win32_Service -ComputerName $vm -Filter "name='IISADMIN'"
if ($iis.State -eq "Running") {
Write-Host "IIS is running on $vm"
}
else {
Write-Host "IIS is not running on $vm"
}
Run Code Online (Sandbox Code Playgroud)
请帮助我使用任何 PowerShell 脚本来检查是否安装了 IIS。
我将我的 Google Drive 添加到我的 OneDrive 并在其中包含一个包含无效名称 (con.mp3) 的文件。当我尝试删除文件(及其所在的目录)时,我收到“无效的文件句柄”。所以我尝试以管理员身份使用 PowerShell 删除它。
下面是目录列表显示的文件,结果Remove-Item和del。
PS> dir
Directory: C:\Users\Patrick\OneDrive\Google Drive\CW\CW.15WPM.VeryShortWords
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/13/2018 11:49 AM 117069 con.mp3
PS> Remove-Item * -Force
Remove-Item : An object at the specified path C:\Users\Patrick\OneDrive\Google
Drive\CW\CW.15WPM.VeryShortWords\con.mp3 does not exist.
At line:1 char:1
+ Remove-Item * -Force
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RemoveItemCommand
PS> del *.*
del : An object at the …Run Code Online (Sandbox Code Playgroud) 我有一个本地包源来处理一些事情。我创建了一个名为 的脑死包CoolUtils,并使用nuget add. 您可以使用 nuget 找到它:
PS> nuget list -source E:\nuget-repo-test-01\
CoolUtils 2.0.20171024.1
PS> nuget list coolutils -source E:\nuget-repo-test-01\
CoolUtils 2.0.20171024.1
Run Code Online (Sandbox Code Playgroud)
但是,Find-Package无法按名称找到它,但可以使用通配符或未指定名称找到它:
PS> Find-Package -Source E:\nuget-repo-test-01\
Name Version Source Summary
---- ------- ------ -------
CoolUtils 2.0.20171024.1 E:\nuget-repo-test-01\ Test package with dumb scripts.
PS> Find-Package *cool* -Source E:\nuget-repo-test-01\
Name Version Source Summary
---- ------- ------ -------
CoolUtils 2.0.20171024.1 E:\nuget-repo-test-01\ Test package with dumb scripts.
PS> Find-Package CoolUtils -Source E:\nuget-repo-test-01\
Find-Package : No match was found …Run Code Online (Sandbox Code Playgroud) 据我所知,在PowerShell中使用$pwd和使用都可以./得到相同的结果。
他们是一样的还是有区别的?
我想cmd.exe在不同的用户下运行一个常规脚本。
我已经使用过Start-Process,当脚本执行时,它只是用不同的用户在屏幕上打开提示,但不处理$command.
cmd.exe所以我的问题是“使用PowerShell运行后如何传递命令?
这是我到目前为止所拥有的:
$username = "abc"
$pwd = ConvertTo -SecureString "xyz" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username $pw
$command = "filepath/.groovy"
try {
Start-Process 'cmd' -Credential $cred -ArgumentList $command
Write-Host $LASTEXITCODE
if($LASTEXITCODE -ne 0) {
throw "Error occured"
} else {
return 0
}
} catch {
Write-Error "Error Desc:$_Error.InnerException.Message";
}
Run Code Online (Sandbox Code Playgroud) 我刚开始在java中学习Lambda并且使用foreach方法(java.util.stream.IntStream.forEach(IntConsumer action))得到了一些问题.我发现用这种方法打印的常用方法就像
forEach(System.out::println)
Run Code Online (Sandbox Code Playgroud)
我想知道是否有办法在一行中打印所有结果
System.out.print(result + " ");
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
public class StudentData {
public static List<Student> getData() {
return Arrays.asList(
new Student(1, "a1", 1, Arrays.asList("cricket", "football", "basketball")),
new Student(2, "a2", 1, Arrays.asList("chess", "football")),
new Student(3, "a3", 2, Arrays.asList("running")),
new Student(4, "a4", 2, Arrays.asList("throwball", "football")),
new Student(5, "a5", 3, Arrays.asList("cricket", "basketball")),
new Student(6, "a6", 4, Arrays.asList("cricket")), new Student(7, "a7", 5, Arrays.asList("basketball")),
new Student(8, "a8", 6, Arrays.asList("football")),
new Student(9, "a9", 8, Arrays.asList("tennis", "swimming")),
new Student(10, "a10", 8, Arrays.asList("boxing", "running")),
new Student(11, "a11", 9, Arrays.asList("cricket", "football")),
new Student(12, "a12", 11, Arrays.asList("tennis", …Run Code Online (Sandbox Code Playgroud) 我正在尝试导入csv,搜索每行中的单元格值(列),然后查找并计算任何空值或空值.然后,如果计数达到13,则执行X.但是,当我运行此代码时,单元格/列值似乎是单个对象而不是每列的单个值?如何搜索行中的单个单元格值?
示例代码
$DataFileLocation = "\\Server\Output.csv"
$sheet = import-csv $DataFileLocation
$count = 0
foreach ($row in $sheet) {
foreach ($column in $row) {
Write-Host "Searching value: $column"
if ($column -eq $null -or " ") {
Write-Host "Found a blank!"
$count++
}
}
$count
if ($count -eq 13) {
Write-Host "Found match!" -ForegroundColor Red
}
$count = 0
}
Run Code Online (Sandbox Code Playgroud) powershell ×7
java ×2
bonobo ×1
delete-file ×1
file-io ×1
foreach ×1
git ×1
grouping ×1
iis ×1
import-csv ×1
java-8 ×1
java-stream ×1
lambda ×1
pwd ×1
service ×1
wmi ×1