Saving info batch

Intel / -
March 3, 2009 at 20:20:50
Specs: Windows XP sp2, -
hello,

firstly this is just for fun so its no big deal.

Ok i have a batch file that saves what you type.

@ECHO OFF
setlocal
set Name=%~f1
if not exist "%Name%" set /p name=Info??:
echo %name% > File.txt

But if i want to save the information that comes
off help (type in help in the cmd.exe and you get
all that help info) what do i do?

do or can i make it so that the info about the
code be set to a varible like %file%?
E.G.

@ECHO OFF
setlocal
set file=(info from about)
if not exist "%file%" set /p name=Info??:
echo %file% > File.txt


Thank you if you can help me.

P.s. What is the command "set file=%~f1" for?
better yet what is "%~f1"


See More: Saving info batch

Report •


#1
March 4, 2009 at 01:19:11
The following code will save output to a filename entered by you. You should enter the batchfile name followed by the command for which you want info:

e.g.
BATCHNAME HELP
BATCHNAME DIR/?
BATCHNAME COPY/?
etc.

:: Code begins....
@echo off
cls

set /p outfile=Enter output path\filename:  
cls

echo %1 Command Help: > %outfile%
%1 >> %outfile%


type %outfile%
:: Code ends....

P.s. What is the command "set file=%~f1" for?
better yet what is "%~f1"

%~f1 would expand the variable %1 to a fully qualified path name. Use the above batch script and For/? to find associated info.


Report •

#2
March 4, 2009 at 15:02:24
Thanks for that. it worked great.

Report •

Related Solutions


Ask Question