Groups

    Anyone good with writing DOS .bat files?

    Banned
    Basically I am looking at replacing a hidden operating system file with one of the same title and hiding it again.

    So far I have written this ..............

    17 Comments

    Original Poster Banned

    @echo off

    attrib -r -h c:\test.txt

    copy d:\test.txt c:\

    attrib +r +h c:\test.txt

    shutdown -r -t 15 -c "Config file changed. PC is now restarting. Remember to remove cd"

    Original Poster Banned

    is there also a command I need to use to show the hidden/protected operating system file or will this work as it is?

    I have just used "test" as the example file just now but it is hidden, marked read only and a hidden/protected operating system file

    looks fine to me, don't know about the shutdown command but the rest looks ok.

    salder21;3514134

    is there also a command I need to use to show the hidden/protected … is there also a command I need to use to show the hidden/protected operating system file or will this work as it is?I have just used "test" as the example file just now but it is hidden, marked read only and a hidden/protected operating system file



    Before you copy it you mean? I think that it'll still copy even if it's hidden?

    Or just unhide it to be sure?

    And whats wrong with what you have written, looks ok to me?

    Maybe put /Y after the copy so it doesn't prompt you to replace the old file?

    Original Poster Banned

    the shutdown command works, I am just trying to create this to save a bit of time at work lol.

    Wasnt sure if I needed a command to unmark 'hide protected operating system files' though, as I needed to originally show the hidden file as well for it to work. Cant test the 'operating system' bit just now though because not at the machines, Im on my laptop just now

    Cheers

    Banned

    Geek!

    Original Poster Banned

    ODB_69;3514227

    Geek!



    lol cheers

    Its called 'work'!

    Banned

    salder21;3514240

    lol cheers :)Its called 'work'!


    Whats that? :?

    Original Poster Banned

    Not too sure considering I am just sitting on my ass doing nithing just now :? lol

    you might have to add -s for system files. So -s to remove system attrib and then +s to add the attrib.

    For your shutdown you can add -f which forces everything to close down. Sometimes when you run the shutdown script it might just wait for a dodgy app to close and the shutdown never runs. Adding the -f improves your chances.

    Original Poster Banned

    huispan;3514649

    you might have to add -s for system files. So -s to remove system attrib … you might have to add -s for system files. So -s to remove system attrib and then +s to add the attrib.For your shutdown you can add -f which forces everything to close down. Sometimes when you run the shutdown script it might just wait for a dodgy app to close and the shutdown never runs. Adding the -f improves your chances.



    thats what i was looking to hear!

    cheers!!! :-D

    If it is a system file you might need a -s/+s on the attrib command.
    Damn - beaten to it!

    Original Poster Banned

    Spod;3514711

    If it is a system file you might need a -s/+s on the attrib command.Damn … If it is a system file you might need a -s/+s on the attrib command.Damn - beaten to it!



    cheers tho - exactly what I was after! :-D

    ODB_69;3514298

    Whats that? :?



    It's a very bad 4 letter word!

    For future reference, this is quite helpful for syntax of Dross Bitch commands:
    computerhope.com/ove…htm

    Original Poster Banned

    added - cheers for your help there
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. Surprise! The HUKD Summer Flamedeer Hunt 2017 **OFFICIAL THREAD** (trading …4532118
      2. Back to school: what's your views on your kids uniform and piercing rules e…27120
      3. If you had £50,000 to start a business what would it be ?2546
      4. How long do we think it’ll be until USB C is considered as safe and univers…66

      See more discussions