نمایش نتایج 1 تا 12 از 12

نام تاپیک: اجرای یک دستور در ساعت مشخص

  1. #1

    اجرای یک دستور در ساعت مشخص

    میخوام سر ساعت مشخصی در روز یک تابع رو اجرا کنم
    استفاده از تایمر بنظرم اشتباه هست چون نه دقت مورد نظررو داره و هم بارگذاری نامطلوبی انجام میده!
    راه دیگه ای هست؟

  2. #2

  3. #3
    کاربر دائمی آواتار RED-C0DE
    تاریخ عضویت
    بهمن 1384
    محل زندگی
    31 4E 20 20 54 48 33 20 20 28 72 59 70 54 30 47 33 4E 31 28 20 20 5C 2F 30 52 31 7C 7C 29 20 20 7C 2
    پست
    551
    از طریق فرمان AT هم می تونی این کار رو انجام بدی..

  4. #4
    کاربر دائمی آواتار zrahimic
    تاریخ عضویت
    آبان 1383
    محل زندگی
    زیر سایه ی خدا
    پست
    181
    سلام
    میشه در مورد AT Command بیشتر توضیح بدید؟

    ممنون

  5. #5
    کاربر دائمی آواتار RED-C0DE
    تاریخ عضویت
    بهمن 1384
    محل زندگی
    31 4E 20 20 54 48 33 20 20 28 72 59 70 54 30 47 33 4E 31 28 20 20 5C 2F 30 52 31 7C 7C 29 20 20 7C 2
    پست
    551
    The AT command schedules commands and programs to run on a computer at
    a specified time and date. The Schedule service must be running to use
    the AT command.

    AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
    AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

    \\computername Specifies a remote computer. Commands are scheduled on the
    local computer if this parameter is omitted.
    id Is an identification number assigned to a scheduled
    command.
    /delete Cancels a scheduled command. If id is omitted, all the
    scheduled commands on the computer are canceled.
    /yes Used with cancel all jobs command when no further
    confirmation is desired.
    time Specifies the time when command is to run.
    /interactive Allows the job to interact with the desktop of the user
    who is logged on at the time the job runs.
    /every:date[,...] Runs the command on each specified day(s) of the week or
    month. If date is omitted, the current day of the month
    is assumed.
    /next:date[,...] Runs the specified command on the next occurrence of the
    day (for example, next Thursday). If date is omitted, the
    current day of the month is assumed.
    "command" Is the Windows NT command, or batch program to be run.

  6. #6

  7. #7

    Question

    نقل قول نوشته شده توسط bermooda
    میشه از TimerCallBack استفاده کرد
    می شه کامل توضیح بدین مثلا در یک ساعت مشخص در روز که کاربر مشخص می کنه از یک سری از فایلها که کاربر مشخص می کنه برای مثلا یک ماه Backup گرفته بشه
    چطوری از TimerCallBack استفاده کنیم

  8. #8
    برنامه من ساده تر از اینه که با Task Scheduler انجام بدم!
    یک برنامه هست که همیشه up هست (مثلا بصورت دستی اجرا میکنیم) و فقط میخوام ساعت 10 صبح یه کاری انجام بده. همین.
    روش ساده تری برای این هست؟

  9. #9
    به نظر من اگه برنامت کوچیکه از Thread.Sleep استفاده کن. یعنی اول اون تکه کد رو توی یه Thread بزار بعد تا زمان موعود، Sleepش کن.

  10. #10
    منظورت چیه تا زمان موعود؟ مشکل اون زمان موعود هستش!
    مگه اینکه بشه گفت تا ساعت 10 صبح sleep باش!
    میشه؟

  11. #11

    long
    remaining;
    remaining =
    DateTime.Parse("10:00").Ticks - DateTime.Now.Ticks;
    if(remaining < 0)
    remaining =
    DateTime.Parse("10:00").AddDays(1).Ticks - DateTime.Now.Ticks;
    System.Threading.
    Thread.Sleep(remaining);

  12. #12
    همینکارو میتونم با یک تایمر انجام بدم!
    فرقش چیه؟

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •