Batch File Not To Run Everyday

Posted on 2008-11-19
Last Modified: 2013-11-22
I have a batch file which is to uninstall frminstal & install framepkg.exe.
I had placed in the server, so after my users login to domain , the batch file run on all computers.
But  I don't want the batch file to run everyday, may once a week. Is there a way ?
Question by:ktancl88
    LVL 14

    Expert Comment

    Yes, there is.  You can do a comparison of the %date% variable so that the batch only runs on a specific day of the week.

    Expert Comment

    you can schedule on the server
    There is a command "at" from command prompt. using which you can schedule for a particular time.
    LVL 14

    Expert Comment

    The "at" is not going to work, because we are dealing with user logon scripts vs. a batch file scheduled to run on the server itself.

    Author Comment

    Dear mds-cos,

    How does this %date% variable be added in to the batch file? How does it work?

    Are you able to show me an example ?
    LVL 14

    Accepted Solution

    Here is the simple way.  There are other ways, but I think this is proably the most straight-forward if you are using DOS level scripting.  I am using two scripts to very easily break apart the day and the date parts of the system variable %date%.

    If you don't want to do this, dig into DOS scripting a bit.  There are other ways to accomplish the same thing.  And of course you could also move to vb script if you want a more powerful scripting language.

    user.bat (or .cmd if you prefer)
    rem  ! Main user login script !
    .... Whatever else your login script does (time sync, drive mapping, printer mapping, etc.)

    rem  script to uninstall frminstal & install framepkg.exe
    call \\%loginserver%\netlogon\frameinstall.bat %date%

    ... Whatever additional you want your login script to do

    frameinstall.bat (or .cmd if you prefer)
    rem ! Script to uninstall frminstal & install framepkg.exe !
    rem ! but only run every Friday                                       !

    rem  if today is not friday exit the script
    IF NOT "%1" == "Fri" goto :EOF

    ...your commands to uninstall frminstal
    ...your commands to install framepkg

    :EOF  (this label is actually optional, since the :EOF label is now assumed by goto)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    There are many HijackThis tutorials on the web already, so this article is about tips that help utilize HijackThis' full potential as a diagnostic tool. Download HijackThis from a TrendMicro link or from known reliable sources only. http://free.…
    These are on the increase and getting more common these days. Users who use the Google search engine may complain of having their search redirected to unwanted sites, regardless of what browser is used. This happens when the system is infected with…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now