Windows XP and 2000 Tips & Tricks UPDATE, June 9, 2003, —brought to you by the Windows & .NET Magazine Network and the Windows 2000 FAQ site
This Issue Sponsored By
Windows & .NET Magazine
- Q. What's the maximum number of arguments that I can pass to a batch file?
- Q. How can I output all of a batch file's arguments?
- Q. How can I shift down by one all of a batch file's arguments?
- Q. How can I configure the Recovery Console (RC) in Windows 2000 and later to not require me to enter the administrator password?
- Q. Why do I receive an error when I'm previewing an image or video from My Computer under Windows XP?
- Learn 10 Ways to Deal with Spam!
- Assessing Security Risks in Exchange 2003
- Security 2003 Road Show
5. Contact Us
- See this section for a list of ways to contact us.
CIO eBook for Managing and Securing the Enterprise - Need in-depth best practices for systems and security management? Register now for the FREE ebook, "From Chaos to Control: The CIO's Executive Guide to Managing and Securing the Enterprise," brought to you by NetIQ and Realtimepublishers.com. Topics covered include: Top 10 Corporate Manageability Policies; Top 10 Overlooked Vulnerabilities; Top 10 Corporate Security Breaches. Take your enterprise systems and applications from chaos to control now.
by John Savill, FAQ Editor, [email protected]
This week, I describe the maximum number of arguments that you can pass to a batch file, how to output all of a batch file's arguments, and how to shift down by one all of a batch file's arguments. I also tell you how to configure the Recovery Console (RC) in Windows 2000 and later to not require you to enter the administrator password and why you might receive an error while previewing an image or video from My Computer under Windows XP.
Around the industry this week, Microsoft has updated its Directory Services Client for Windows 9x--for more information, see the Microsoft article "Availability of the Directory Services Client Update for Windows 95 and Windows 98" ( http://support.microsoft.com/?kbid=323466). You must obtain the new client through Microsoft Product Support Services (PSS).
Microsoft has also released the first patch for Windows Server 2003. The patch addresses a vulnerability that lets Web sites run damaging code on the server. Finally, the company has released MSN Explorer 8.5, which you can download at the Microsoft http://download.microsoft.com/download/5/f/8/5f8a4821-eb6b-469e-85ec-6e29a67c4e60/msnsetup_min.exe, and plans to release Windows Update 5.0 beta soon.
Sponsor: Windows & .NET Magazine
Insider's Guide to IT Certification eBook
Get the eBook that will help you get certified! The "Insider's Guide to IT Certification," from the Windows & .NET Magazine Network, has one goal: to help you save time and money on your quest for certification. Find out how to choose the best study guides, save hundreds of dollars, and be successful as an IT professional. The amount of time you spend reading this book will be more than made up by the time you save preparing for your certification exams. Order your copy today!
Q. What's the maximum number of arguments that I can pass to a batch file?
A. You can pass as many as nine arguments (%1 to %9) to a batch file. For example, if I run test.bat
@rem test.bat @echo off echo %1 %2 %3 %4 %5 %6 %7 %8 %9
C:\>test a b c d e f g h i
the batch file accepts all nine arguments and displays the following output onscreen:
a b c d e f g h i
Argument 0 (%0) is the name of the program or batch file. If you attempt to pass an argument numbered higher than 9 (e.g., 11), the batch file will use only the first digit of the argument number--for example, %11 would become parameter 1 (i.e., %1) and %543 would become parameter 5 (i.e., %5). If I include a few two-digit arguments in test.bat
@rem test.bat @echo off echo %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %21 %32
and run the batch file by typing
C:\>test a b c d e f g h i j k l
the batch file displays the following output onscreen:
test a b c d e f g h i a0 b1 c2
Notice that the batch processor amends a number to the parameters that it displays for the two-digit arguments. For example, for parameter 10 (%10), the batch processor used parameter 1 (value a) and added 0 to the end to display a0.
Q. How can I output all of a batch file's arguments?
A. Although you can typically output only nine parameters from a batch file, you can use a percent symbol (%) followed by an asterisk (*) to output all parameters for all arguments passed into a batch file. For example, if I run test.bat
@rem test.bat @echo off echo %*
C:\>test a b c d e f g h i j k l m n o p
the batch file will display the following output onscreen:
a b c d e f g h i j k l m n o p
Q. How can I shift down by one all of a batch file's arguments?
A. You can use the Shift command to move all the arguments in a batch file down by one. If the batch file calls this command once, then argument %1 would become the second argument instead of the first and argument %0 would become the first argument instead of the name of the program or batch file. For example, when I run test.bat
@rem test.bat @echo off :next if "%0" == "" goto end echo %0 shift goto next :end
C:\>test a b c d e f g h i j k
the batch file will display the following output onscreen:
test a b c d e f g h i j k
You can optionally add /n to the end of the shift command where n is the argument to start from. For example, if you used
%3 would become %2, %4 would become %3, but %0 and %1 would be unchanged. Obviously, you shouldn't use the /n switch in the above example because doing so will cause the list of parameters to never run out, thus causing a never-ending loop.
Q. How can I configure the Recovery Console (RC) in Windows 2000 and later to not require me to enter the administrator password?
A. To configure the RC to not require you to enter the administrator password, perform the following steps:
- Start a registry editor (e.g., regedit.exe).
- Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole registry subkey.
- Double-click SecurityLevel, set its value to 1 to not require password entry (or 0 to require the user to enter the password), then click OK.
- Close the registry editor.
You can also use the Microsoft Management Console (MMC) Local Security Settings snap-in (go to Local Policies, Security Options, "Recovery console: Allow automatic administrative logon") to configure this setting.
Q. Why do I receive an error when I'm previewing an image or video from My Computer under Windows XP?
A. The error you describe,
Video Preview Failure Creation of the video preview failed. Please check the device connection and make sure that the device is not being used by another application or user.
is a known problem that can occur if you unplug and reconnect an imaging device without closing My Computer. To resolve this problem, close and re-open My Computer.
(from Windows & .NET Magazine and its partners)
In this audiocast event, you'll discover simple but effective ways to fight spam, plus learn the common tricks spammers use to get your email address. You'll also receive a free white paper from NetIQ about controlling spam and the chance to download a free trial of NetIQ MailMarshal SMTP. Register today!
Videotaped live at Microsoft TechEd 2003, this free archived Web seminar delivers an introduction to the new security features and enhancements of Exchange Server 2003, including the new security APIs that can minimize virus risk and spam traffic. Plus, you'll discover more about the future of the messaging industry and what's on the horizon in assessing risk. Register today!
(brought to you by Windows & .NET Magazine)
Join Mark Minasi and Paul Thurrott as they deliver sound security advice at our popular Security 2003 Road Show event.
Integrate FAX into Exchange/Outlook (Whitepaper, ROI, Trial)
5. Contact Us
Here's how to reach us with your comments and questions:
- About the newsletter — [email protected]
- About technical questions — http://www.winnetmag.com/forums
- About product news — [email protected]
- About your subscription — [email protected]
- About sponsoring UPDATE — [email protected]
This weekly email newsletter is brought to you by Windows & .NET Magazine, the leading publication for Windows professionals who want to learn more and perform better. Subscribe today.
Receive the latest information about the Windows and .NET topics of your choice. Subscribe to our other FREE email newsletters.