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-1665489

VB88's questions

Martin Hope
VB88
Asked: 2022-12-26 04:37:47 +0800 CST

批量Ping码

  • 5

我从 Youtube 视频中获得了以下脚本,但我想知道将 -1 10 放入 ping 命令的目的或功能是什么。谁能帮我提供这个信息!提前致谢。

@echo off

:top
set /p "ip=Input IP or target name to ping : "

ping -n 1 %ip% | find "TTL="
ping -n 2 -1 10 127.0.0.1 >nul 
goto top
batch
  • 1 个回答
  • 15 Views
Martin Hope
VB88
Asked: 2022-11-07 23:41:45 +0800 CST

使用 REGISTRY KEY 查找已安装的程序

  • 6

我使用以下批处理来检查是否安装了 Adob​​e Reader。运行时,它会显示已安装程序的 REGISTRY KEY 详细信息。怎么可能不显示 REGKEY 详细信息?

REM Check file existence in REGISTRY KEY
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe" /ve
if not errorlevel 1 (
echo Adobe Reader already installed
ping /n 6 localhost>nul 2>&1
) else (
echo Install Adobe Reader now
pause
Call "%~dp0..\Step 3 - Install Adobe Reader DC\Installer\Full_Setup_adobe_DC.bat"
)

在此处输入图像描述

batch
  • 1 个回答
  • 16 Views
Martin Hope
VB88
Asked: 2022-09-16 17:13:30 +0800 CST

Robocopy 文件夹图标在运行后更改

  • 5

我最近发现在Win10中使用ROBOCOPY命令复制整个USB内容时,目标文件夹的图标总是变为DOCUMENTS的图标,我需要手动将其更改回普通文件夹的图标。谁能告诉原因以及如何纠正它!(即使我在运行 robocopy 命令之前提前手动创建了文件夹,图标也发生了变化)

robocopy f: %userprofile%\downloads\D114_Backup0915 /mir /a:sh /r:0 /w:0

在此处输入图像描述

batch
  • 1 个回答
  • 27 Views
Martin Hope
VB88
Asked: 2022-08-31 10:15:24 +0800 CST

在PowerShell中解释文件夹路径

  • 5

我想将文件路径批量转换为powershell脚本。我的批处理文件路径是

Xcopy %~d0\Software\Browsers\ChromeStandaloneSetup64.exe" %userprofile%\downloads

我在powershell脚本下尝试过,但没有找到。

Copy-Item -Path "${PSScriptRoot}\Softwares\Browsers\ChromeStandaloneSetup64.exe" -Destination "$($env:USERPROFILE)\downloads"

我相信我在 Powershell 中为 %~d0 批量使用了错误的路径缩写。请帮我纠正它。谢谢。
(我的 powershell ps1 文件存储在名为 Xray 的文件夹中,但 .exe 文件存储在另一个名为 Softwares\Browsers 的文件夹中。Xray 和 Softwares 文件夹都在 USB 驱动器中)

powershell
  • 1 个回答
  • 29 Views
Martin Hope
VB88
Asked: 2022-08-24 00:20:13 +0800 CST

使用 FOR /f 查找结果后运行命令

  • 5

我想在找到结果时运行该命令,但它似乎不起作用。我们的计算机名称类似于 HS-33-123-WC、HS-34-456-X 结果似乎不是我想要的。如果 %%a==WC goto dhcp 和 if %%a==X goto static 我似乎没有制作正确的脚本

REM Display the 4th group of character(s) after -
wmic computersystem get name
for /f "tokens=4 delims=-" %%a in ("%computername%") do (echo %%a && goto next)


:next
if  %%a==WC goto dhcp
if %%a==X goto static


:static
echo Static
pause
goto end

:dhcp
echo This is DHCP
pause
goto end

:end @exit /b

batch
  • 2 个回答
  • 22 Views
Martin Hope
VB88
Asked: 2022-08-18 01:43:13 +0800 CST

创建批处理文件以激活 Office 2016

  • 6

我使用下面的脚本来激活我们的 Office 2016。有没有办法在一行中组合密钥和激活,因此在运行批处理时需要交互。

pushd %programfiles%\Microsoft Office\Office16

Echo Activate Office 2016 (64 bit)
echo. =================================
set /p key="Input Office 2016 KEY : "
echo. =================================


cscript ospp.vbs /inpkey:%key%
cscript ospp.vbs /act

@exit /b

popd
batch
  • 1 个回答
  • 228 Views
Martin Hope
VB88
Asked: 2022-08-17 06:38:44 +0800 CST

在 Windows 中使用代理服务器关闭/打开命令行或 Powershell 脚本

  • 5

是否有任何脚本可以使用代理服务器设置打开/关闭。我做了一些研究,但没有找到正确的答案。我试过这个,但没能成功。

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t 
REG_DWORD /d 0 /f

在此处输入图像描述

在此处输入图像描述

cmd.exe
  • 1 个回答
  • 26 Views
Martin Hope
VB88
Asked: 2022-08-16 19:24:01 +0800 CST

运行批处理文件以手动激活 Windows 10 许可证密钥

  • 5

我想知道我的代码是否能够一个接一个地运行命令,而无需在激活 Windows 后单击“确定”进行交互,或者我应该在每个命令行上添加“Start /wait cmd”.....”之类的命令。

@echo off

REM Windows Activation

Echo Activate Windows
set /p key="Input Windows Key : "

slmgr /ipk %key% /ato  && ^ 
wmic csproduct && ^
gpupdate /force

Modified

@echo off
REM Windows Activation
Echo Activate Windows
echo. =================================
set /p key="Input Windows KEY : "
echo. =================================


cscript %windir%\system32\slmgr.vbs /ato | find /i "successfully" &&  (goto status)

:status
Echo Check Windows Status
SetLocal EnableExtensions EnableDelayedExpansion
Set "WinVerAct="

For /f "tokens=*" %%W in ('
cscript /Nologo "C:\Windows\System32\slmgr.vbs" /xpr
') Do Set "WinVerAct=!WinVerAct! %%W"
if Not defined WinVerAct ( 
Echo:No response from slmgr.vbs
Exit /B 1
 
Echo Windows Version Activation Status:
Echo:"%WinVerAct:~1%"

wmic csproduct && ^
gpupdate /force

@exit /b
cmd.exe
  • 1 个回答
  • 221 Views
Martin Hope
VB88
Asked: 2022-06-16 18:28:08 +0800 CST

添加注册表项

  • 6

我按照建议创建批处理文件以添加注册表项。请告知这是否正确

reg add HKLM\Software\microsoft\windows\CurrentVersion\Explorer /v Scaling   /t MonitorSize /D 
25 /f

在此处输入图像描述

batch-file
  • 1 个回答
  • 332 Views
Martin Hope
VB88
Asked: 2022-04-21 07:15:52 +0800 CST

创建后打开文本文件

  • 5

请帮助查看文件创建成功后无法打开查看的问题所在。

dim fname
fname=InputBox("Enter File Name:")
MsgBox("The File name is " & fname)

' Const ForReading = 1, ForWriting = 2, ForAppending = 8

Const ForReading = 1
Const OpenAsASCII = 0
Const OverwriteIfExist = -1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set fResultFile = objFSO.CreateTextFile(fname & ".txt", _
OverwriteIfExist, OpenAsASCII)

Set objInputFile = objFSO.OpenTextFile("iplist.txt", ForReading)
arrIpList = Split(objInputFile.ReadAll, vbCrLf)
objInputFile.Close

For l = 0 To UBound(arrIpList)
strIP = Trim(arrIpList(l))
If strIP <> "" Then
If Not IsConnectible(strIP, "", "") Then
fResultFile.WriteLine strIP & " is down"
End If
End If
Next


' Open Result file
Set inCsvSys = CreateObject("Scripting.FileSystemObject")
Set inCsv    = inCsvSys.OpenTextFile(fname & ".txt")
WScript.Echo "FIle found and opened successfully"





Function IsConnectible(sHost, iPings, iTO)
' Returns True or False based on the output from ping.exe
' Works an "all" WSH versions
' sHost is a hostname or IP
' iPings is number of ping attempts
' iTO is timeout in milliseconds
' if values are set to "", then defaults below used

Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1
Dim oShell, oFSO, sTempFile, fFile

If iPings = "" Then iPings = 2
If iTO = "" Then iTO = 750

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")

sTempFile = oFSO.GetSpecialFolder(2).ShortPath & "\" & oFSO.GetTempName

oShell.Run "%comspec% /c ping.exe -n " & iPings & " -w " & iTO _
& " " & sHost & ">" & sTempFile, 0 , True

Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _
FailIfNotExist, OpenAsASCII)

Select Case InStr(fFile.ReadAll, "TTL=")
Case 0 IsConnectible = False
Case Else IsConnectible = True
End Select

fFile.Close
oFSO.DeleteFile(sTempFile)

End Function
vbscript
  • 1 个回答
  • 87 Views
Martin Hope
VB88
Asked: 2022-04-17 08:07:00 +0800 CST

查找删除的文件数

  • 5

我想知道通过批处理脚本删除了多少文件。我找到了一个脚本并对其进行了修改,但它不起作用。任何想法如何解决它。

set-location d:\testing -ErrorAction stop               # Change directory
$files = get-childitem -File                                   # Get all 
the files in this directory
$folders = get-childitem -directory                            # Get all 
the folders in this directory

$count = ($files|measure).count                                # 
($files|measure).count gives how 
                                                           # many files 
are in this collection.
$countfo = ($folders|measure).count                            # 
($files|measure).count gives how 
                                                           # many files 
are in this collection.

Start-Sleep -s 5

write-host "There are $($count) files to be deleted."          # Write 
that to the screen.
$files | remove-item                                           # remove 
the files

write-host "There are $($countfo) folders to be deleted."      # Write 
that to the screen.
$folders | remove-item                                         # remove 
the files

$files = get-childitem -File                                   # Get all 
the files in this directory
                                                           # after the 
delete to find out how
                                                           # how many 
remained.

$folders = get-childitem -directory                              # Get all 
the folders in this directory
                                                           # after the 
delete to find out how
                                                           # how many 
remained.


$count2 = ($files|measure).count                               # 
$countfinal = $count-$count2

$countfo2 = ($folders|measure).count
$countfofinal = $countfo-$countfo2

write-host "$($count2) files remained. " -NoNewline            # 
write-host "$($countfinal) files were deleted. "               # 

write-host "$($countfo2) folders remained. " -NoNewline        # 
write-host "$($countfofinal) folders were deleted. "           # 

Start-Sleep -s 5

迅速的

countif
  • 1 个回答
  • 103 Views
Martin Hope
VB88
Asked: 2022-02-24 05:12:36 +0800 CST

使用批处理脚本创建任务计划程序添加唤醒计算机条件

  • 6

我有一个批处理脚本来创建任务计划程序,但我想将条件添加到唤醒这台计算机以运行此任务。此任务的目的是将计算机从睡眠模式中唤醒。我已经在网上搜索了很多文章,但我找不到有关此功能的任何解决方案。任何有才华的人都可以帮助我完成这项工作。该代码只是一个简单的代码,如下所示:

schtasks /create /sc weekly /d mon,tue,wed,thu,fri /tn "Wake_Auto" /tr "%userprofile%\documents\sleeptowake\PC_Wake.cmd" /st 09:00

PC_Wake cmd 如下:

Echo Hello!
ping 127.0.0.1
exit
windows command-line
  • 1 个回答
  • 259 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