Anyone good with writing DOS .bat files? - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

Anyone good with writing DOS .bat files?

salder21 Avatar
banned8y, 2w agoPosted 8 years, 2 weeks ago
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 ..............
salder21 Avatar
banned8y, 2w agoPosted 8 years, 2 weeks ago
Options

All Comments

(17) Jump to unreadPost a comment
Comments/page:
banned#1
@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"
banned#2
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
1 Like #3
looks fine to me, don't know about the shutdown command but the rest looks ok.
#4
salder21
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?
1 Like #5
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?
banned#6
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#7
Geek!
banned#8
ODB_69
Geek!


lol cheers :)

Its called 'work'! :p
banned#9
salder21;3514240
lol cheers :)

Its called 'work'! :p

Whats that? :?
banned#10
Not too sure considering I am just sitting on my ass doing nithing just now :? lol
1 Like #11
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.
banned#12
huispan
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
1 Like #13
If it is a system file you might need a -s/+s on the attrib command.
Damn - beaten to it!
banned#14
Spod
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! :p :-D
#15
ODB_69
Whats that? :?


It's a very bad 4 letter word!
#16
For future reference, this is quite helpful for syntax of Dross Bitch commands:
http://www.computerhope.com/overview.htm
banned#17
added - cheers for your help there :)

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!