... but then you would have to run it as each username (e.g. from each user's computer) to create the output file for each user.
Main Topics
Browse All TopicsI'm trying to create a batch file that will take the output of the ipconfig /all command and sent it to a text file named with the users profile name. The command works fine at the command prompt, but I can't figure out how to make a batch file from it. Here's what I got:
ipconfig /all >"C:\Documents and Settings\%USERNAME%\Deskto
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Dickdole,
The command will be more compatible with different installations if you use the %USERPROFILE% variable to locate the desktop:
ipconfig /all >"%USERPROFILE%\Desktop\%US
As an example, I have my Vista installation on the C: drive, but XP is loaded on the D: drive. So statically listing "C:\Documents and Settings" will fail on my system. This is also true for some domain accounts where the user's profile folder has the domain appended to the username like this:
C:\Documents and Settings\username.Domain\
pb
Hi SysExpert,
The double variable marks are generally only needed when you are using FOR command variables.
For example, this command will work just fine at the command line:
FOR /L %F IN (1,1,10) DO @ECHO Number %F
But for use in a batch file, you would need to use the following:
FOR /L %%F IN (1,1,10) DO @ECHO Number %%F
However, the following command will work exactly the same whether typed directly at the command line or used in a batch file:
ECHO %USERPROFILE%
On my system, this displays:
D:\Documents and Settings\pbarrette
If, instead, I double the percent signs like this:
ECHO %%USERPROFILE%%
Then I get different output from the command line vs a batch file. The batch file displays:
%USERPROFILE%
But the commandline displays:
%D:\Documents and Settings\pbarrette%
That's because when you put two percent symbols together in a batch file, the first percent symbol effectively acts as an escape character to the second. So the first gets stripped off as it is passed to the command interpreter, leaving the second behind to be interpreted as a variable marker by the command interpreter.
So, in the above example, "ECHO %%USERPROFILE%%" in a batch file gets the first percent symbol of each pair stripped off as it is passed to the interpreter, so you are left with the command interpreter being told to display "%USERPROFILE%". But at the command line, the inner most percent symbols get parsed as a variable, and the outer percent symbols are simply ignored.
pb
Business Accounts
Answer for Membership
by: knightEknightPosted on 2008-08-13 at 05:47:00ID: 22221168
Just put that same command in a text file with a .bat extension.