Results 1 to 10 of 10
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    The "code" looks OK, but a batch file should have extension .bat instead of .bas

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    Sorry that is a typo...like the "btch" typo in the Title of this post! (Sorry about that!)

    I did have the file as a .bat file? Still...it does not change the file attributes. Am I missing something silly here?
    Regards,
    Rudi

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    Check the path in the batch instruction. Perhaps it contains a typo too... <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

    The path is good.

    Something else: I forgot to mension that I have a switch in the line!
    attrib +r C:TestDirMyFiles*.* /s
    I thought i'd be clever and add a pause command after this line and it pauses the dos prompt and I can see that it complains about an invalid switch...but help uses the /s switch in its examples too!!!
    Any more ideas regarding this info? (PS: Don't tell me I mis-spelt the switch!! - <img src=/S/grin.gif border=0 alt=grin width=15 height=15>)
    Regards,
    Rudi

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    It works fine if I copy the line

    attrib +r C:TestDirMyFiles*.* /s

    into a batch file and substitute a valid path. Try copying the line back from your post into the batch file, or typing the entire line from scratch.

  6. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windo

    If there is a space anywhere in the path, remember that you have to put the whole path in double-quotes!

    e.g. "C:Test DirMy Files*.*"

    John

    PS And reading your subsequent post, if you have two commands on the same line, you need an ampersand between them, as in:

    attrib +r C:TestDirMyFiles*.* /s & pause
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  7. #7
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windows XP Home Edition)

    OK. I got it working now!

    The only difference that I can think of between the code I ran yesterday and today is that yesterday I was running it from the E: drive where today I created the bat file on the C: drive. (I cant see if this would cause the problem...) anyhow..its working now.

    Thanks Hans
    Regards,
    Rudi

  8. #8
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windo

    <hr>...need the attributes of these files to be hidden and read-only... <hr>
    You may already have noticed this, but your above examples don't set the hidden attribute, only read only. You also need the +H switch.

    Edited to correct typo.

  9. #9
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help to create a btch file instruction! (Windo

    Thx for that correction. I do have the +h in my "now working" batch file. But just to keep the thread accurate based on the opening post, and thx to BigAlDoc, here is the complete and working syntax:

    <big>ATTRIB +r +h CirNameSubDirName*.* /s</big>
    (Replace Names with relevant folder names! - naturally!)
    Regards,
    Rudi

  10. #10
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Help to create a batch file instruction...

    Hi,

    I have about 65 files, (*.mht, *.doc) in a certain directory on my Harddrive. I need the attributes of these files to be hidden and read-only! I searched in the help files and found a line that shows how to do this. I took the sample and pasted it into Notepad and modified it to point to a directory on my HHD: attrib +r C:TestDirMyFiles*.*. Then i saved it as ConvertFiles.bas to create a batch file. Then in explorer i double click on it and I see it swiftly open and close the dos prompt window. when i go and look at the file attributes in the directory by right clicking the file...the attributes are not activated.

    Can anyone help me create a batch file are assist in advice, as my method explained above is not doing the job!!!

    Tx
    Regards,
    Rudi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •