找不到带数字的变量 [英] Can't found the variable with number

查看:64
本文介绍了找不到带数字的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

echo off
SETLOCAL EnableDelayedExpansion
set caminho="C:\Users\%username%\AppData\Local\Microsoft\Outlook"

set maxbytesize=10



for /F %%i in ('dir /b "C:\Users\%username%\AppData\Local\Microsoft\Outlook\*.ost"') do (


   set directoria=%caminho%\%%i

%1 %0 :: %directoria%
set len=%~z2

if %len% LSS %maxbytesize% (
msg * algo
PAUSE

) ELSE (
msg * O ficheiro exedeu 29Gb, diriga-se a Informatica

)

)

我在这方面不太好,所以我需要一些帮助. 我有一个类似的代码可以工作,但是当我转换"为它时,它开始说10 is not expected为10,而%maxbytesize%. 有一些方法可以使这项工作,或者我需要重新开始?

Im not so good in this so i need some help. I have a similar code that works, but when i "transform" into this it starts to say that 10 is not expected being 10 the %maxbytesize%. There some way to make this work or i need to start all over again??

推荐答案

这些变量均不需要设置,因为它们不在代码外使用或在代码内操纵:

None of those variables need setting because they are not used outside of the code or manipulated within the code:

@Echo Off
Rem If "%~1"=="" Exit/B

Set "MaxByteSize=31138512896"

For %%A In ("%LocalAppData%\Microsoft\Outlook\*.ost") Do (
    Rem "%~1" "%~f0" :: "%%~fA"
    If %%~zA Lss %MaxByteSize% (msg * algo) Else (
        msg * O ficheiro exedeu 29Gb, diriga-se a Informatica))

如果您确实使用单个参数运行脚本,则删除 Rem 的两个实例.

If you really are running the script with a single argument then remove both instances of Rem.

这篇关于找不到带数字的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆