PowerUsers.info - Paul Doherty Askme Archive of Questions and Answers

Return to AskMe Archive Main Page

Return to Main PowerUsers.info Main Page

Category : Operating Systems


----------------------------------------------------------------------
FAQId : 52392
Subject : Dos Batch (.bat) programming question

Question : In the interest of saving money (by not buying a RAID controller), I was wondering if it was possible to write a batch program that would execute the following when run:

copy c:\(all files and directories) d:\

I know copy c:\*.* will only get me the files in the root, so I really have two questions. One: How do you copy all files and directories, including sub-directories in DOS, and Two: Is it possible to make it copy only the files modified within a certain time period, like maybe the same day or within the past X number of hours? Any help would be greatly appreciated.

Answer : To copy all the files on the whole disk you can create a batch file and use the 'at' scheduler (add the scheduler service first before using 'at' on the command prompt under NT Server). The batch file could look as follows:

@echo off
c:
cd \
attrib -r -h -s *.* /s
xcopy c:\*.* d:\*.* /e /m /q /y >nul

The above batch file will copy only the files that have not already been copied, or ones that have changed since the last copy. The first time you run this I would suggest you do the following and then run our batch file one time manually:

c:
cd \
attrib -r -h -s +a *.* /s

Now run the batch file one time manually - this will ensure that all files got copied at least once. From here on out they will be picked up based on modification or being new.

Now you can set this up to be automatic with the 'at' scheduler (under NT Server) or with Task Scheduler (on systray in Win9X). We'll call our batch file backmeup.bat) and schedule it to run at night:

at 01:00 /every:M,W,F,Su "d:\wherever\backmeup.bat"

The above line would run the backmeup.bat file at 1:00 AM every Monday, Wednesday, Friday and Sunday.


Have fun!
Paul Doherty, CNA (3 & 4), CNE, MCP+I, MCSE, B.A.Sc.
Rating :

----------------------------------------------------------------------
FAQId : 108438
Subject : 10/100 vs. 10 Baset

Question : I'm just getting to know this forum... excuse the duplicity...
What is the difference between 10/100 and 10 Baset? A little technically speaking, I mean.

Answer : 10BaseT is nothing more than this (broken down):

"10" = means 10 Mbit (MegaBit/sec) transfer

"BaseT" = means it is "twisted pair" cabling, as opposed to coaxial cable (10Base2) which is also 10Mbit.


10/100 is usually a reference for a card, hub, or switch that can "autosense" whether another device can receive at 100Mbit or only at 10Mbit and will set itself accordingly for the fastest possible transfer rate. So literally speaking 10/100 merely means that the card can talk at *both* 10Mbit or 100Mbit (some 100Mbit cards only do 100Mbit but they're rare - for example the NetGear starter kit comes with a 100Mb 4 port hub, and 2 100Mb cards - all of which cannot transfer at 10Mb - only 100Mb)

Paul Doherty
Rating :
Rating :
Rating : thank you so much - it was exactly what I was looking for!
Rating :

----------------------------------------------------------------------
FAQId : 1744215
Subject : Auto Insert in Win 2000

Question : Hi Paul,

How do I disable the Auto Insert option for CD drives in Win 2000 Professional etc.

Every time a put a cd in the tray, the cd automatically boots. I wish to turn this option off. I know that you can press the Shift key to disable this. Is there a better way to disable Auto Insert.
I am tri-booting my laptop with Win 2000 Professional, Server and Advanced Server. I wish to disbale auto insert on all three operating systems.

many thanks

toby abbs

Answer : You will have to edit the registry to disable this feature under 2000.

Start/Run/regedit.exe

Once in the program open the following key:

HKEY_LOCAL_MACHINE\system\currencontrolset\services\cdrom\

Select the "autorun" item at the right and dbl click it - enter a value of 0 to disable autorun entirely.

If you only want to disable this for specific user accounts you will edit a similar item under the HKEY_CURRENT_USER branch. Here are the details:

http://msdn.microsoft.com/library/psdk/shellcc/shell/Shell_basics/Autoplay_reg.htm#nodrive

Paul Doherty
http://members.home.net/iqueue


Answer : Sure, Toby... always glad to be of help where I can.

And you're welcome for the answer...

Take care and keep plugging!

Paul Doherty, CNA, CNE, MCP+I, MCSE, B.A.
http://members.home.net/iqueue
Rating : Thank You very much - just edited the registry and rebooted the machine. disabled and looking good. I am currently studying for my MCSE in the UK - If I get stuck can I ask you again for help? Many thanks Toby
Rating :
Rating :

----------------------------------------------------------------------
FAQId : 3546545
Subject : computer reboots when shut down

Question : my computer reboots when I try to shut it down

Answer : Try this online shutdown troubleshooter:

http://support.microsoft.com/support/tshoot/default.asp

Barring that, here are some step-by-steps:

http://www.freespeech.org/Khephra/a/shutdown.htm

--
Paul Doherty
http://members.home.net/iqueue



Rating :

----------------------------------------------------------------------
FAQId : 4493506
Subject : start

Question : When I shut down my pc, “ NOW IT’S SAFE TO TURN OFF YOUR COMPUTER “ will come out on the screen. Can I change the test, let say I wanna change it to …..BYE BYE… … if I can, can u pliz teach me ?



Can I change the word START on my desktop to OPEN ?

Thank you.

Answer : For changing your startup/shutdown screens:

http://winfiles.cnet.com/apps/98/startup-tools.html

For changing the text of the "Start" button.

1) Get a hex editor and install it - here's one:

http://www.softseek.com/Programming/Editors/Review_18142_index.html

2) Make a backup copy of C:\WINDOWS\EXPLORER.EXE and a copy for the new text :

(Open a DOS prompt)

copy c:\windows\explorer.exe c:\windows\explorer.bak

copy c:\windows\explorer.exe c:\windows\explorer.new

3) Open Axe and use it to open c:\windows\explorer.new

4) Press CTRL-F, select Raw Hex Bytes as the search type and search for:

53 00 74 00 61 00 72 00 74

Press F3 until you loop around to the top again then come back to the last instance found near the bottom. You'll know you have the right one as there is an error message just below the one you want that starts "There was an internal error". Click on the square that has the "S" in "Start" and type over each character you want to be something different. Any character spaces you don't use click in their corresponding cell on the left pane and type "00" (that's two zeroes) over them.

5) Save the file, restart in DOS mode and:


c:
cd \windows
copy /y explorer.new explorer.exe
exit

And you should be done - if something goes wrong boot into DOS again and retore the original:

c:
cd \windows
copy /y explorer.bak explorer.exe


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities


----------------------------------------------------------------------
FAQId : 5686667
Subject : Redhat 7.1 mouse

Question : Hi

I would like to configure the mouse on Redhat 7.1. My mouse has two buttons and a wheel. Is it possible to configure the wheel as a button so that the mouse can now function as a 3-button mouse? I've never configured a mouse in Red Hat before.

Thanks, Cindy

Answer : You likely already have third-button-functionality. Try this test. Open two terminal windows inside X-Windows (type startx to enter Windows if you're not logging in graphically). WIth the two terminal windows openn type some text or do an 'ls'. Now drag across some of the text in that window to highlight it, and go to the other window, left-click it once and then middle-click the wheel. If your mouse is configured properly this will act as a paste from clipboard.

If it doesn't work then you are not configured - you will either need to edit /etc/X11/XF86Config and be sure that the items ChordMiddle and Emulate 3rd button (not sure how it appears - search for it in the mouse section where you find ChordMiddle). Be sure both of those lines are commented out (# in the first column) and restart the X Server or reboot.

Finally if you can't get the editing done you can run 'xf86config' or 'Xconfigurator' but I don't really recommend changing it this way as you may inadvertantly change a video setting too. Make backups of the files before changing them too.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : Also see this web page for further assiatnce on adjusting the mouse - there may be a GUI way to change the setting without having to manually edit the XF86Config file:

http://www.redhat.com/support/manuals/RHL-7.1-Manual/install
-guide/s1-guimode-sel-mouse.html

Rating :

----------------------------------------------------------------------
FAQId : 5703606
Subject : search and replace

Question : Hi

On the website running Apache on Solaris, there is a link change. It was http://www.amazon.com. Now, the link is changed to http://www.bn.com. This link affects more than 150 web pages. My boss is asking me to write a script to search through all the web pages and automatically do a search and replace of all these links from http://www.amazon.com to http://www.bn.com

I am relatively new to perl and I'm trying to figure out how to write a perl script to do this. In the mean time, my boss is pressuring me to get this done quickly. Is there a tool or program to do this.

Thank you , Cindy

Answer : You're welcome!

Paul

Answer : No need for perl here - a regular shell script should do nicely. Here is one I whipped up for you:

#!/usr/bin/ksh

find ./*.html | while read file
do
cat $file | sed 's/http:\/\/www.one.com/http:\/\/www.three.com/' > /tmp/tmpout
cp /tmp/tmpout $file
done

Put that in a file (call it switch.ksh) and then running this series of commands should process all .html files from that directory down and replace all occurrences of "http://www.amazon.com" to "http://www.bn.com":

chmod 700 switch
(next line is an optional command to backup all files before modifying in case of a problem)
tar -cvpf ../backup.tar ./*
./switch


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

FUQuestion : Hi Paul

It works, but only in the current directory. There are many sub directories. Is there a way to make the find command to search for all directories?

Thank you, Cindy

FUQuestion : I figured out by entering "find . *.html"

Thank you very much
Cindy

----------------------------------------------------------------------
FAQId : 6098061
Subject : Red Hat Linux

Question : Hi,

I have just installed Red Hat Linux 7 on my second hard drive. Althouth when I boot to Linux it doesn't altomatically go to X, I have to type in "startx". Can you possibly tell me how to :
1. make it go straight into Xwindows GUI
2. How to logout in the command line interface, I did it once with the shutdown command, but cannot replicate this task. I must have been in as root or something.....Is there a standard way to logout of using the shutdown command. And do I have to in a certain directory to do it.

Thanks
Regards
Rob


Answer : Sure...

If you are sure your X-Windows is working fine (after a 'startx' it enters the windowing environment without issue) you can do the following to make the system enter the windowed login at boot:

vi /etc/inittab

(look for a line in the first 10 or 15 lines that looks like the line below)

id:3:initdefault:

Change the 3 to a 5 and save/exit. Next time you boot you should see the login screen. If for some reason it fails boot into single-user mode and change it back.

At the command line to logout you can press:

CTRL-D (appears as ^D)

or type exit

If you want to reboot or shutdown you can do that with these (as root):

reboot:
shutdown now -r

halt:
shutdown now -h

No special directory is needed.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

PowerUsers.info - Paul Doherty Askme Archive of Questions and Answers

Return to AskMe Archive Main Page

Return to Main PowerUsers.info Main Page