Well for today’s Windows tip, I’m going to present you with one thing that has annoyed my for a REALLY long time. Whenever you goto access files on a computer on your local network in explorer, the system will seem to “hang” for a bit. This can be VERY irritating, trust me. Alright well here’s how to fix it and why the problem is there in the first place:
Issue: Content displaying is sluggish when browsing the network with Explorer. This is most noticeable when going from Windows 2000/XP to Windows 9X/ME Machine.
When browsing network resources, Windows 2000/XP will try to find shared printers and scheduled tasks on the computer you try to connect to.
Solution:
* Step 1: Click Start > Run
* Step 2: Type in regedit in the prompt
* Step 3: Navigate to the Key Below: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace]
* Step 3: Delete the Sub-Key with (Default) string value set to “Printers” {2227A280-3AEA-1069-A2DE-08002B30309D} * Step 4: Delete the Sub-Key with (Default) string value set to “Scheduled Tasks” {D6277990-4C6A-11CF-8D87-00AA0060F5BF}
Note: You may experience a delay if that system has a printer shared.
After you’re done it should look something like this:
Ok well for our second tip, (Just because I feel bad for the site being down for so long, you get two) I’m going to talk about batch files (some call them scripts, in my opinion they are the black sheep of the script family). They are Bill Gates’ answer to bash scripting. (I had a great article written about bash scripting, but when my site went down it got hosed, look out for a new one in the next Linux Tip.) I am not going to cover all the theory and practice of batch files from the ground up. Any good book on DOS (now found in the Antiquities section of your local library :-] ), and many of the best on Windows, will have a section on batch files. Simply put, a batch file is a plaintext file with a name ending in .BAT. In its simplest form, it contains a series of commands that could be executed from a command prompt (system prompt). The batch file simply autoexecutes them for you. (In fact, AUTOEXEC.BAT is the best known, and most widely used, batch file.) To execute a batch file, type its name at a command prompt, or execute a Windows shortcut that does the same thing. If you are unsure how to open the command prompt, the best way is to go to Start > Run > type ‘cmd’ and press [Enter]. This will open up the generic DOS Prompt.
The simplest idea of how to write a batch file is: Figure out how you would type the commands at a DOS prompt, then type them, one per line, in a text file — and you’ve written your batch file.
DOS environment variables also can be used as variables in batch files. For example:
COPY %windir%\filename a:
Where does one get a list of DOS environment variables? I have never found a comprehensive list; but here’s the really cool part! You can make them up as you go along, and assign them as you wish (as long as you don’t grab one that has a legitimate assigned value, such as, say, %windir%, the Windows directory name!). Pick a name, populate it with the SET command by any means known to you (including having one batch file run a process that includes setting one, and then another batch file using it), then use it by placing the name between flanking % signs. Environment variables remain until overwritten, or until a reboot. (If you set them in a DOS window, they will end when that session is closed.)
Silly example: To change the current logged drive to D:, do the following:
SET GONEXT=D: %GONEXT%
By the way, a partial but lengthy list of existing environment variables can be gotten by typing SET at a command prompt.
START Command
The START command can launch a Windows program either by specifying the program name (and its command-line parameters), or by specifying a data file name that is associated with a particular program (one that would automatically launch if you clicked on it in Windows).
For example, if you have NOTEPAD.EXE associated with all TXT files, then you could open the file SOME.TXT in any of the following four ways:
NOTEPAD SOME.TXT SOME.TXT START NOTEPAD.EXE SOME.TXT START SOME.TXT
Why use one or the other? Well, sometimes you may have to use one particular form to get a result — depending, for example, on how the particular program is coded. Though the first form usually will work, you may want, for example, to write a more general batch file to open any particular program and associated file — without knowing what the requirements of all such files might be. You could, then, write a general batch file line such as START %1% %2%.
You may use any of four command line parameters with the START command. These go after the word START, but before the program name:
/minimized or /m /maximized or /max /restored or /r /wait or /w
The first three determine the screen status in which the program opens. The last one forces the batch file to halt processing until the called program has finished executing. (This can be useful, for example, if you are loading multiple items in your windows Startup folder, and the nature of the programs require that one be finished before the next starts loading. Put them all in a single batch file, using the /wait parameter, and only put a shortcut to the batch file in the Startup folder.) Command line parameters of the START command can be combined in a single line. Example:
START /max /wait NOTEPAD.EXE SOME.TXT
IF and IF NOT Commands
There are three variations of the IF and IF NOT commands.
* IF EXIST: Execute the commandline only if a particular file exists:
IF EXIST some.txt COPY c:/some.dll %windir%/SYSTEM/some.dll
* Compare two text strings, and execute the commandline only if they are identical.
IF %HostWinBootDrv%==C SET WinDir=C:\WINDOWS
* Error testing: Check the exit code of the most recently run program. If it is equal to or greater than the number specified, execute the command:
IF ERRORLEVEL 4 ERASE trashfile.tmp /P
This is were Mr. Gates kinda fudged a little. All (good) programmers know that Goto statements are basically the spawn of satan. But in this instance there is really no other option. You can set a label in a batch file by beginning a line with a colon. You can then go directly to that label with the GOTO command. The GOTO command searches both forward and backward in the batch file; that is, it simply goes to the label location, regardless of where it is in the file.
For example, in my batch file for removing the Happy99 virus, UNHAPPY.BAT, the following code was used to make sure a file was not deleted unless the original form of it (backed up by the virus under the name WSOCK32.SKA) is present:
IF NOT EXIST WSOCK32.SKA GOTO SavedIt DEL WSOCK32.DLL RENAME WSOCK32.SKA WSOCK32.DLL :SavedIt
The syntax for this command is: FOR variable in (set list) DO command
The variable must be in the form of one alphabetic character preceeded by %%; e.g., %%v.
NOTE: The %% is necessary because this is in a batch file which, otherwise, would give a special meaning to a single %. However, if you run the FOR command outside of a batch file, simply from the system prompt, just use a single % in the variable name. (Tip from Steve Wisdom)
The set list is enclosed within parentheses. These values will be assigned to the variable successively. You can use any text enclosed in quotes, batch file commandline parameters, environment variables, or DOS file wildcard expressions.
The command can be any valid command that otherwise could be entered into the batch file as a line of its own. example:
FOR %%D in (SYSTEM, COMMAND, SHELLNEW, “Start Menu”) DO DIR “%windir%\%%D” /W
Each of these options (START, IF, GOTO, FOR) is an actual DOS command. At a system prompt, type the command name followed by /? to get further help on these items.
Note that there may be particular capabilities that show up in one version of Windows, but not in another. For example, though DOS per se may well be dead in Windows XP, the commandline functions people most often associate with DOS are not dead at all! (We just don’t call them “DOS commands” anymore; we call them “command prompt commands”. But they’re the same thing.) In some cases, these commands have been made more powerful in Windows XP. In particular, if Win XP Command Extensions are enabled, each of these four has very greatly enhanced capabilities (see Win XP Help & Support to learn about Command Extensions). Take advantage of the opportunity to explore each of them with the /? help flag.
Some Examples (that don’t even require Command Extensions): START has new flags that let you set the priority (/LOW, /NORMAL, /HIGH, etc.) of the application you are launching. IF has an ELSE option than greatly expands its power, but which requires a somewhat complicated syntax sometimes (which the /? help text covers reasonably well).
Since these START, IF, GOTO, and FOR are actual OS commands, they can be used from a system prompt just like DIR, COPY, or any other DOS command. This means that they can be used outside of a batch file as well. There are small differences or issues that you can easily discover in use, and discussion of which would go beyond the purpose of the present page. For anyone comfortable working at a DOS system prompt, this should present no significant problem.
Alright that was a pretty long Windows tip, and for those who stuck through and actually read the whole thing, I thank you, and hope you gained something from it. Well as always I’m available for anything you may need at brasonmyguitar@gmail.com
yummmy…… thanks to your ideas , i’d love to comply with your blog as frequently as i can.possess a good day~~
Name (required)
Mail (will not be published) (required)
Website
yummmy…… thanks to your ideas , i’d love to comply with your blog as frequently as i can.possess a good day~~