Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: [Batch script] How to locate an .ini file with a name which starts with "nsc"  (Read 8377 times)

0 Members and 1 Guest are viewing this topic.

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
" Anyone who goes to a psychiatrist should have his head examined. "

mangolzy

    Topic Starter


    Rookie

    • Experience: Beginner
    • OS: Windows 7
    There were 14 posts in this thread before you told us what you wanted.

    Sorry for the misleading,

    but as a newhand, i try to break my problem down, and solve them one by one, until i suddenly found out the first one who answered this question actually helped me before, but his solution still has a little problem....

    i don't know, perhaps this problem seems easy for you, but as i haven't ever learned about the batch, i have no idea except following other's code......

    so do you think it's possible to solve the problem of blank line and the return of parted path?

    Voila

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    i don't know, perhaps this problem seems easy for you, but as i haven't ever learned about the batch, i have no idea except following other's code......

    You have all the people who monitor the topics here and who are willing to help for free, if you only tell them what you are doing and how you want the task done.

    Those who have offered suggestions already have just wasted their time - because you did not describe the actual task in the very first post.
    We like coding, we enjoy writing scripts to solve a task - we hate being frustrated because people don't give us the correct information to do so.



    mangolzy

      Topic Starter


      Rookie

      • Experience: Beginner
      • OS: Windows 7
      You have all the people who monitor the topics here and who are willing to help for free, if you only tell them what you are doing and how you want the task done.

      Those who have offered suggestions already have just wasted their time - because you did not describe the actual task in the very first post.
      We like coding, we enjoy writing scripts to solve a task - we hate being frustrated because people don't give us the correct information to do so.

      Sincerely excuse me.

      But it will be more efficient if I haved stated the problem I want to solve clearer, I thought I have open a thread for it otherwhere but not many reply...................

      On the other hand, I don't think all these replies are wasting time, because they allow me to learn something about batch, there are so many parameters or options and I don't really get a manuel ....................

      Thank you all the same!

      mangolzy

        Topic Starter


        Rookie

        • Experience: Beginner
        • OS: Windows 7
        so this is the link to my original problem:

        http://www.computerhope.com/forum/index.php/topic,145039.msg910673.html#msg910673

        no one reply, i don't know if it's because of my bad explaination or it's complicate or perhaps people don't want to give all the code to such a problem freely, that means i got the answer so easily...............


        BUT ANYWAY, I thought this forum is one of the most active forums that I have looked for help.

        I really beg your pardon, for those pass their time reading all these........... :'(

        Lemonilla



          Apprentice

        • "Too sweet"
        • Thanked: 70
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 7
        Let me make my problem clear:

        I want to search in the whole system all the file begins with nsc and type of .ini;

        once we found one path of this kind of file, we replace all the 10.23.96.46 with 10.23.96.98 in the file.

        that's all the functionality that i want,

        up to now with your help. there is no problem in locating all the files qualified,

        1.   but still a little problem in the treatment of file, that's to say in the replacement when i try to read the file line by line, then when it comes to a blank line, the code i provided yesterday, will fill in the blank line with  "10.23.96.46=10.23.96.98"

        2.   do you know how to get the folder where a file is in with a completed path of this file??

              that means:  for a file   H:\NSC\Test\nsc.ini, with the string "H:\NSC\Test\nsc.ini"  How can we return a string like this    "H:\NSC\Test\"??

        Thank you again!

        If you are working in a for loop, you use this to find the path:

        %%~pdA
        or it's %~pdA, can't remember if you still have to escape.

        assuming you used %%A as your variable
        Quote from: patio
        God Bless the DOS Helpers...
        Quote
        If it compiles, send the files.

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        so this is the link to my original problem:

        http://www.computerhope.com/forum/index.php/topic,145039.msg910673.html#msg910673

        no one reply, i don't know if it's because of my bad explaination or it's complicate or perhaps people don't want to give all the code to such a problem freely

        Your explanation is not clear, it has no details but uses XXX.EXE and XXX.INI plus there is the language difficulty.
        We don't know how you have to log in to the remote machines, which versions of Windows are being used, what program you will use to restart the service, which folder tree the files are in.

        For your original post, I didn't reply because there are so few details and the task is very unclear.

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Perhaps this thread should be locked - here is a follow up to your original post and which has a link to this thread:

        http://www.computerhope.com/forum/index.php?topic=145039.msg911889#msg911889