Tag Archive: vista


Tips for Using the Vista Command Shell

Command-line tips specific to Windows Vista are given.

For the most part, the features of the command line are the same in Vista as they are in Windows XP but there are some differences. (The Vista version is 6.0 whereas the XP version is 5.1.) Here are some tips that apply only to Vista.

Run as administrator in Vista

The Windows Vista operating system has a security feature called User Account Control that limits the privileges of users by default. Since the command line is usually involved with administrative tasks, you’ll often want to run as an administrator. This can be done each time by right-clicking the icon for the command prompt and choosing “Run as” from the context menu . A more convenient way is to set the command prompt to run with administrator privileges by default. Right-click the command prompt shortcut icon and choose “Properties” from the context menu. Click the “Advanced” button and put a check by “Run as administrator”. Click “OK”. Note that you will still get the UAC message when you open the command prompt.

Another way to run the command prompt as administrator is to enter “cmd” in Start Search and then use the keyboard combination Ctrl+Shift+ Enter.

“Open Command Window Here” in Vista

It is now easy to open a command prompt referenced to a folder of your choice in Vista. If the Shift key is held down while right-clicking a folder, the context menu will contain an entry, “Open Command Window Here”. Selecting this entry will open a command prompt with the chosen folder as the reference point for commands.

Open command window with administrator privileges anywhere

The “Run as administrator” option mentioned above always opens with \Windows\System 32\ as the working directory. To open a command console with administrator privileges in any directory of choice, you can add a command to the right-click context menu. The INF file to make the appropriate Registry edit can be downloaded here. It is from the PowerToy utility described at this link.

Send command output to the Windows clipboard with clip.exe

Vista comes with a command-line utility clip.exe that can be used to redirect or pipe the output of another command to the Windows clipboard. The command uses a “pipe” and has the form: somecommand | clipFor example, to send a directory listing to the clipboard, the command is: dir | clip

Place the contents of a text file into the Windows clipboard with clip.exe

The utility clip.exe can also be used to read a text file and place its contents in the Windows clipboard. The command has the form: clip < somefile.txt

The batch file command called "choice" is back in Vista

Oldtimers will remember that DOS had a command for batch files called "choice" that allowed for some limited user interaction. The command was then removed from 32-bit command shells because the "set /p" option gave equivalent or better functionality. However, "choice" is back in Vista in a new form. Enter "choice /?" in a Vista command prompt for details about its features.

Use the "choice" command to make a Vista batch file wait

One useful application of the "choice" command is to make a batch file pause for a specified period of time. The statement has the form: choice /T n /D y > nul The switch "/T n" specifies a wait period of n seconds. The switch "/D y" creates a default choice of "yes". To suppress the unwanted text output of the command, it is redirected to the null device (nul).

Use the "timeout" command to make a Vista batch file wait

Another new command in in Vista is "timeout". It will cause the command processor to wait for a specified number of seconds or until a key is pressed. The format is timeout /T n where n is the number of seconds to wait. To make the command ignore any key presses, the switch /nobreak can be added: timeout /T n /nobreak Because the command gives output listing the time remaining, it may be necessary to use a redirect to nul. timeout /T n > nul

Switch added to "Dir" to enable viewing Alternate Data Streams

NTFS files can have added information in "streams" or "forks". These added items are normally hidden from access by most Windows functions such as Explorer. In Vista a switch /R has been added to the "dir" command that allows alternate data streams to be listed.

Enable the built-in master administrator account on the log-in screen

Vista contains a master administrator account but it is not normally visible on the log-in screen. To enable it, open a command window with administrator privileges and use the command net user administrator /active:yes (Make sure that you assign a password to the account.) To remove the account from the log-in screen, use the command net user administrator /active:no

Reduce the space used by System Restore

System Restore can use up to 15% of a hard drive for its backup files (shadow storage). As hard drives get ever bigger, that becomes a lot of space. The command "vssadmin" can be used to administer settings for System Restore. To control the space allocation, open a command prompt with administrator privileges and enter vssadmin Resize ShadowStorage /For=C: /On=C: /Maxsize=[n] For [n] enter the desired size in MB or GB. The units must be stated: for example, "Maxsize=500MB" or "Maxsize=2GB". The example is for the C: drive. WARNING! This will delete all your old Restore Points!

Increase the file system memory cache

If you tend to open and close a lot of files, you may be able to increase performance by creating a larger value for a special cache setting with the file system utility command fsutil behavior set memoryusage 2According to Microsoft, this increases something called the "paged pool" memory. Do not use if you are already consuming large amounts of system memory with other activities. If performance after the change is unsatisfactory, undo it with the commandfsutil behavior set memoryusage 1These commands require administrator privileges. The commands change a Registry setting and take effect after a reboot.

Use "takeown" to access certain files

Vista protects many system files for security reasons and even an administrator is not allowed to access them. If you are denied access to a file while in an administrator account, you can use the command line tool "takeown.exe" to reassign ownership. You will need to run the command from a command prompt with administrator privileges. The syntax is takeown /f some_file [/a] [/r]The specified filename can contain wildcards. You can also specify a folder. The optional switch "/a" transfers ownership to the administrators group. If omitted, the default is to transfer ownership to the present user account. The switch "/r" recurses subdirectories. Although this command assigns ownership, it does not give control rights. Thus if you wish to modify a system file (often not a good idea) you will probably have also to apply the "icacls" command discussed next.

Obtain control rights to a file with "icacls"

(Icacls.exe supersedes the "cacls" command of Windows XP. The older command is still available, however.) This command has a rather complex set of options. They can be displayed by entering "icacls /?" in a command prompt. One example is the command to grant full access rights to an account named user:icacls file_name /grant user:F

Clean up Vista SP1 files

When you install Vista service pack 1, a facility for uninstalling it is also created. If you have SP1 installed for a while and are satisfied that you will keep it, you can remove the uninstall files and free up almost a GB of disk space. To remove the backup files, use the command VSP1CLN.EXE (I have used caps to make the difference between "one" and "ell" clear but case doesn't matter.) Administrator privileges are required. After running this command, you will be unable to uninstall Vista SP1 so be sure you really want to keep it.

Using drag and drop- not

The useful capability to drag commands and drop them into a command prompt that was present in past versions of Windows does not work in Vista. (However, it has been restored in Windows 7.)

Outlook 2007 Gadgets for Windows Sidebar

Screen shot of the Outlook Sidebar gadgets If you’re a fan of the Outlook 2007 To-Do Bar, but wish your upcoming appointments and tasks could be shown even when Outlook was minimized, I’ve got great news for you, you can do this today with the Outlook Sidebar Gadgets.

One of the new features introduced in Windows Vista is the Windows Sidebar, an application that allows gadgets—small applications that provide quick access to useful information or commands—to be displayed on your desktop or in the Sidebar.

The Sidebar presented a great opportunity for Outlook to surface the same information that we show in the To-Do Bar. To this end, we developed two Outlook gadgets: Outlook Appointments and Outlook Tasks. These gadgets can be used independently or together to provide at-a-glance information without the need to bring up Outlook.

The calendar gadget shows 3 or 5 of your upcoming appointments just as they would appear in the To-Do Bar. Appointments are colored based on assigned categories and show the title, time, and location. You can even double click an appointment to open the appointment in Outlook and see more details about the appointment, or to respond or otherwise interact with the appointment.

The task gadget shows all the tasks from your task list and lets you scroll up and down through the list. You can customize the view of your task list as well. By default the gadget shows your tasks grouped by due date, however, through the gadget options you can group by category, due date, start date, or importance. You can also select which groups to show, so if you only want to see high priority tasks or those with a particular category you can filter the view accordingly. To edit the gadget options, move your mouse cursor over the gadget, and click on the small wrench icon that appears by the top right corner of the gadget.

The task gadget also lets you interact with your task list. You can quickly add a new task (when Outlook is running). Just click in the gadget, type a task name, and press enter and a new task is created. You can also mark a task complete by checking the box next to the task.

Because the gadgets are always running in the Sidebar, you can quickly see when your next appointment is and what your next tasks are. If you have a higher resolution monitor you can use the Sidebar options to make the Sidebar always on top so your gadgets and Outlook appointments and tasks are always visible. If you have a smaller screen, you can leave the Sidebar with the default setting and when you want to see have you have to do next, use a hotkey (Windows key + Spacebar) to bring the gadgets to the top of all applications

Both gadgets are available on the Windows Live Gadget Gallery, or by clicking the links below:

Enjoy!

Ryan Gregg
Program Manager, Outlook

A better weather gadget (and other Vista sidebar tricks)

In a comment to my earlier weather-related post, Chris asks:

Is that a special Vista weather gadget? It looks way better than the default one as it has some forecasting too. I tried looking for it but didn’t find anything. Any pointers?

That’s actually the standard Vista weather gadget. So why does mine look different from yours? There’s a good opportunity to introduce the concept of undocked sidebar gadgets.

By default, adding the weather gadget to the Vista sidebar produces a tiny display like this one:

image

You get the current temperature, the city name, and an icon indicating the general weather conditions (in this case, clear and daytime – a moon icon would appear if it were after dark). You can’t do anything else with this icon. There’s no easy way to see a more detailed view of current conditions or get to a multi-day forecast.

Unless, of course, you drag the icon off the sidebar. When you release it over the desktop or any running program,, you get a much larger gadget:

image

This view has a three-day forecast and the day’s high-low range. Most importantly, that city name is a live link that takes you to the MSN weather page for the location. (To reset your default location, let the mouse pointer hover over the gadget until a small toolbar appears in the top left corner. Click the wrench icon and enter your zip code or city.)

Having the weather gadget on the sidebar is convenient because you always see it. By contrast, when the gadget is floating, it is usually covered by open windows. To bring the gadget to the top, press Windows logo key+spacebar.

Once you learn that keystroke combination, it’s usually pretty easy to have the best of both worlds. Keep the gadget on the sidebar to see the small display. Drag it onto the desktop when you want more details, and drag it back onto the sidebar when you’re done.

Update: Another alternative, recommended by Robert in the comments, is the WeatherBug gadget. When I looked at it, I found aWeather Channel gadget, which has a cool fly-out forecast menu.

Installing Windows XP Ntbackup on Windows Vista

In order to install the Windows XP Ntbackup program on your Windows Vista computer you will need to following files from a Windows XP computer:

Ntbackup.exe
Ntmsapi.dll
Vssapi.dll

These can be found in the C:\Windows\System32 folder of Windows XP.

You could also copy these help files, but you don't really need them:
Ntbackup.chm
Ntbackup.hlp

These can be found in the C:\Windows\Help folder of Windows XP.

Copy all 3 (or 5) files to a folder in your Vista Program Files folder, for example use C:\Program Files\Ntbackup. Since you won't be pasting these files in the system path there is no need to worry about overwriting files.

Next, you will need to turn on or install the Removable Storage Management feature (you will get an NTSMAPI.dll error if Removable Storage Management is not enabled).

To turn on Removable Storage Management in Windows Vista:

  1. Click the Start button > Control Panel > Programs, and then click Turn Windows Features on or off. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
Powered by WordPress | Theme: Motion by 85ideas.