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

techguy1029's questions

Martin Hope
techguy1029
Asked: 2019-08-14 10:57:16 +0800 CST

7zip 只会压缩某些文件

  • 6

我有一个用于压缩旧文件并删除它们的脚本。该脚本在所有其他目录中工作正常,但一个特定目录将无法工作。它会尝试将其压缩,但最终只会创建一个名为 .zip 的空 zip 文件Program.7z。这让我觉得脚本中的空格没有被正确转义。我在我的路径中使用了双引号和单引号并检查了文件路径的串联。我还没有找到它可能是什么。有任何想法吗?

Const fileZillaLogs = "C:\Program Files (x86)\Server\Logs"
Const zipProgram = """C:\Program Files\7-Zip\7zG.exe"""
Const zipArgs = "a -mx9"
Dim intZipAge
intZipAge = 7
Dim intDelAge
intDelAge = 90


Call DeleteLogFiles(fileZillaLogs, intZipAge, intDelAge)



Function DeleteLogFiles(strLogPath, intZipAge, intDelAge)
  Const bDEBUG = True
  Dim objFs
  Dim objFolder
  Dim objSubFolder
  Dim objFile
  Dim objWShell
  Dim strCommand
  Dim iResult
  Set objWShell = CreateObject("WScript.Shell")
  Set objFs = CreateObject("Scripting.FileSystemObject")
  If Right(strLogPath, 1) <> "\" Then
    strLogPath = strLogPath & "\"
  End If
  If objFs.FolderExists(strLogPath) Then
    Set objFolder = objFs.GetFolder(strLogPath)
      For Each objSubFolder in objFolder.subFolders
        DeleteLogFiles strLogPath & objSubFolder.Name, intZipAge, intDelAge
      Next
      For Each objFile in objFolder.Files
        If bDebug Then wscript.echo vbTab & "reviewing file = " & strLogPath & objFile.Name
        If DateDiff("d",objFile.DateLastModified,Date) > intDelAge Then
          If bDebug Then wscript.echo "Deleting because its old" End If
          objFs.DeleteFile(strLogPath & objFile.Name)
        Else If DateDiff("d",objFile.DateLastModified,Date) > intZipAge _
          And (Right(objFile.Name, 4) = ".log") Then
            If bDebug Then wscript.echo vbTab & "zipping file = " & objFile.Path
            strCommand = zipProgram & " " & zipArgs & " " & objFile.Path & ".7z" & " " & objFile.Path
            iResult = objWShell.Run(strCommand, 0, "false")
            If bDebug Then wscript.echo vbTab & "zipping result = " & iResult
            If bDebug Then wscript.echo vbTab & "deleting file = " & strLogPath & objFile.Name
            objFs.DeleteFile(strLogPath & objFile.Name)
            End If
        End If
      Next
    Set objFs = Nothing
    Set objFolder = Nothing
    Set objWShell = nothing
  End If
End Function
command-line zip
  • 1 个回答
  • 49 Views
Martin Hope
techguy1029
Asked: 2019-08-08 13:14:31 +0800 CST

如何跟踪成功的登录和断开连接?

  • 5

我试图跟踪用户每次远程访问计算机以及每次断开连接的时间。我正在使用 Powershell 来执行此操作。这就是我用来做这个的

Get-WinEvent -Computer $env:ComputerName -FilterHashTable @{LogName='Security';ID=4634,4672} | Select-Object @{N='User';E={$_.Properties[1].Value}},TimeCreated,ID,$MachineNameProperty

如果我错了请纠正我,但我的问题是事件 4634也可以申请失败的登录事件。我只想要成功的事件。此外,事件 4672似乎仅在管理员登录时适用,如果我错了,请再次纠正我,但我希望任何用户都能成功登录。如何仅跟踪任何用户的成功登录和断开连接?哪个事件日志最适合这个?我希望日志也能够提供用户信息。事件 ID 4624并不总是提供用户信息。

powershell remote-desktop
  • 1 个回答
  • 548 Views
Martin Hope
techguy1029
Asked: 2019-04-02 12:42:27 +0800 CST

根据事件仅运行一次计划任务

  • 2

我有一个任务,每次系统内存低于 10% 时我只想运行一次。 定时任务触发器

这会一直运行到内存低于 10% 还是只运行一次?如果它运行到不到 10%,我如何让它只运行一次?

我正在运行的任务是一个 PowerShell 脚本

windows scheduled-tasks
  • 1 个回答
  • 2040 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