AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-1101064

bckelley's questions

Martin Hope
bckelley
Asked: 2020-04-17 11:33:51 +0800 CST

未解决的导入“chromedriver_install”Python(未解决的导入)

  • 5
py -m pip install chromedriver_install
Requirement already satisfied: chromedriver_install in c:\users\bckelley\appdata\local\programs\python\python38-32\lib\site-packages (1.0.3)

有谁知道如何解决这个问题?

python3 import
  • 1 个回答
  • 195 Views
Martin Hope
bckelley
Asked: 2020-02-22 14:01:10 +0800 CST

将批处理文件重写为powershell

  • 6

我有一个批处理文件,它查看 inf 文件并找到 open= Open= 或 OPEN= 并让程序运行。

@echo off
setlocal ENABLEDELAYEDEXPANSION

set _drive=W:
set _cmd=

cd /d !_drive!\
for /f "tokens=1,2* delims==" %%i in (autorun.inf) do (
  if "%%i"=="open" set _cmd=%%j
  if "%%i"=="Open" set _cmd=%%j
  if "%%i"=="OPEN" set _cmd=%%j
)
if not defined _cmd (
  echo Unable to parse autorun.inf and find 'open='
) else (
  !_drive!\!_cmd!
  START !_drive!
)

endlocal

我希望有人比我自己更擅长powershell,因为我一直在网上寻找一些东西。所以我应该提到这是这里的OP

powershell batch-file
  • 2 个回答
  • 1441 Views
Martin Hope
bckelley
Asked: 2019-11-05 10:01:00 +0800 CST

将 Hyper-V VM Ip 地址添加到每个 VM 的 VM 注释

  • 5

所以我已经知道这个代码是

Set-VM -Name "localhost" -Notes "127.0.0.1"

使用 $ipAddress = get-vm | where { $_.state -eq 'running'} | get-vmnetworkadapter | Select @{Name="IP";Expression={$_.IPAddresses | where {$_ -match "^192\."}}} | Sort VMName

获取我的 IP 地址

IP          
--          
127.0.0.1

所以完整的代码是这样的

$ipAddress = get-vm | where { $_.state -eq 'running'} | get-vmnetworkadapter | Select @{Name="IP";Expression={$_.IPAddresses | where {$_ -match "^192\."}}} | Sort VMName
Set-VM -Name "server1" -Notes "$ipAddress" 

但是当我添加 foreach 循环时

$vms = Get-VM
$ipAddress = get-vm | where { $_.state -eq 'running'} | get-vmnetworkadapter | Select @{Name="IP";Expression={$_.IPAddresses | where {$_ -match "^192\."}}} | Sort VMName

foreach ($vm in $vms) {
    Set-VM -Name "$vm" -Notes "$ipAddress"
}

为每个虚拟机产生这样的错误

Set-VM : The specified wildcard character pattern is not valid: VirtualMachine (Name = 'server1') [Id = 'de0994fb-c19b-48a3-9389-fd595bd3dc43']
At line:2 char:5
+     Set-VM -Name "$vm" -Notes "$ipAddress"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-VM], VirtualizationException
    + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.SetVM

我不明白为什么它可以在没有循环但不能使用的情况下工作

编辑:根据 Pimp Juice IT 的建议来回应

VirtualMachine (Name = 'server1') [Id = 'de0994fb-c19b-48a3-9389-fd595bd3dc43'] VirtualMachine (Name = 'server2') [Id = 'ecb80604-1f4a-4493-97cd-14d474baca30'] VirtualMachine (Name = 'server3') [Id = '71a01492-f70e
-420e-9db8-1718ac5d9b41'] VirtualMachine (Name = 'server4') [Id = '500387d7-95e0-44a6-9819-425d4b7af876'] VirtualMachine (Name = 'server5') [Id = '4eef3925-1ae5-4410-8fee-2f99bbfd7ec5'] VirtualMachine (Name = 'serv
er6') [Id = '337f1016-4001-457e-b231-b84173efd695'] = Get-VM
@{IP=192.168.0.39} = get-vm | where { .state -eq 'running'} | get-vmnetworkadapter | Select @{Name=
IP;Expression={.IPAddresses | where { -match ^192\.}}} | Sort VMName
foreach (VirtualMachine (Name = 'server6') [Id = '337f1016-4001-457e-b231-b84173efd695'] in VirtualMachine (Name = 'server1') [Id = 'de0994fb-c19b-48a3-9389-fd595bd3dc43'] VirtualMachine (Name = 'server2') [Id = 'e
cb80604-1f4a-4493-97cd-14d474baca30'] VirtualMachine (Name = 'server3') [Id = '71a01492-f70e-420e-9db8-1718ac5d9b41'] VirtualMachine (Name = 'server4') [Id = '500387d7-95e0-44a6-9819-425d4b7af876'] VirtualMachine (
Name = 'server5') [Id = '4eef3925-1ae5-4410-8fee-2f99bbfd7ec5'] VirtualMachine (Name = 'server6') [Id = '337f1016-4001-457e-b231-b84173efd695']) {
    Set-VM -Name VirtualMachine (Name = 'server6') [Id = '337f1016-4001-457e-b231-b84173efd695'] -Notes @{IP=192.168.0.39}
}
powershell hyper-v
  • 1 个回答
  • 165 Views
Martin Hope
bckelley
Asked: 2019-10-14 11:44:05 +0800 CST

VLOOKUP 多个值

  • 7

我希望有人可以帮助解决这个问题,我正在尝试在表格中找到工资并返回基于申请状态的百分比。

在此处输入图像描述

microsoft-excel microsoft-office-2010
  • 3 个回答
  • 407 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve