Loading ...
Sorry, an error occurred while loading the content.

Re: [BATCH WORLD] Need help with batch file

Expand Messages
  • kn srivastava
    ... Thanx Marc. It works like a charm but I didn t understand how you got the .exe filename. May be it s not my cup of tea. Thank you once again. Regards
    Message 1 of 33 , Nov 4, 2012
    View Source
    • 0 Attachment
      On Thu, Nov 1, 2012 at 6:59 PM, Marc Peterson <marc.peterson@...> wrote:

      > Maybe try, e.g.,:
      >
      > for /f "delims=" %%a in ('dir /s /b /a:d ^| findstr /e .if9') do (
      > echo %%a
      > cd "%%a"
      > %%~na.exe -startup:alone < run_control.txt
      > echo PSCAD successfully executed in "%%a\.." >> "%outfile%"
      > )
      >

      Thanx Marc. It works like a charm but I didn't understand how you got the
      .exe filename. May be it's not my cup of tea.

      Thank you once again.

      Regards
      Kailash


      [Non-text portions of this message have been removed]
    • Marc Peterson
      ... Capture the hour, use if logic to check the hour against your time window, use start to launch with high priority. So putting it together, maybe something
      Message 33 of 33 , Jan 15, 2013
      View Source
      • 0 Attachment
        >> 1) From 18:00 PM to 06:00 AM use all CPU resources and run the %%~na.exe
        >> with highest priority and speed.

        Capture the hour, use if logic to check the hour against your time window,
        use start to launch with high priority. So putting it together, maybe
        something like this (untested):

        for /f "delims=" %%a in ('dir /s /b /a:d ^| findstr /e .if9') do (
        for /f "delims=:" %%h in ("%time%") do (
        echo %%a
        cd "%%a"
        if /i %%h leq 6 start /high %%~na.exe -startup:alone < run_control.txt
        if /I %%h geq 18 start /high %%~na.exe -startup:alone < run_control.txt
        echo PSCAD successfully executed in "%%a\.." >> "%outfile%"
        cd ..
        )
        )

        Though it would certainly make more sense to check the time first.

        --Marc


        > -----Original Message-----
        > From: batchworld@yahoogroups.com [mailto:batchworld@yahoogroups.com] On
        > Behalf Of goshainganj
        > Sent: Tuesday, January 15, 2013 9:57 AM
        > To: batchworld@yahoogroups.com
        > Subject: Re: [BATCH WORLD] Need help with batch file
        >
        > Marc,
        >
        > The following advice turned out to be a boon for me. It works like a
        > charm.
        >
        > I wonder if it is possible to incorporate the following in this script:
        >
        > 1) From 18:00 PM to 06:00 AM use all CPU resources and run the %%~na.exe
        > with highest priority and speed.
        >
        > Regards and thanx
        > Kailash
        >
        >
        > --- In batchworld@yahoogroups.com, "Marc Peterson" wrote:
        > >
        > > The ~n modifier on %%a extracts the base part of the name, so if %%a is
        > > XXXXX.if9 then %%~na is XXXXX and %%~na.exe is XXXXX.exe. See the last
        > > section of "for /?" for more info.
        > >
        > > --Marc
        > >
        > > -----Original Message-----
        > > From: batchworld@yahoogroups.com [mailto:batchworld@yahoogroups.com] On
        > > Behalf Of kn srivastava
        > > Sent: Monday, November 05, 2012 1:46 AM
        > > To: batchworld@yahoogroups.com
        > > Subject: Re: [BATCH WORLD] Need help with batch file
        > >
        > > On Thu, Nov 1, 2012 at 6:59 PM, Marc Peterson wrote:
        > >
        > > > Maybe try, e.g.,:
        > > >
        > > > for /f "delims=" %%a in ('dir /s /b /a:d ^| findstr /e .if9') do (
        > > > echo %%a
        > > > cd "%%a"
        > > > %%~na.exe -startup:alone < run_control.txt
        > > > echo PSCAD successfully executed in "%%a\.." >> "%outfile%"
        > > > )
      Your message has been successfully submitted and would be delivered to recipients shortly.