Computing.Net > Forums > Programming > Saving info batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Saving info batch

Reply to Message Icon

Name: rjone187
Date: March 3, 2009 at 20:20:50 Pacific
OS: Windows XP sp2
CPU/Ram: -
Product: Intel / -
Subcategory: Batch
Comment:

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"



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: March 4, 2009 at 01:19:11 Pacific
Reply:

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.


0

Response Number 2
Name: rjone187
Date: March 4, 2009 at 15:02:24 Pacific
Reply:

Thanks for that. it worked great.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


find computername from a ... connect asp.netwith mssql...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Saving info batch

write, save & run a batch file www.computing.net/answers/programming/write-save-run-a-batch-file/17547.html

Can a disk be formatted w/o losing info? www.computing.net/answers/programming/can-a-disk-be-formatted-wo-losing-info/2241.html

Excel VBA - batch file in Dos - She www.computing.net/answers/programming/excel-vba-batch-file-in-dos-she/3568.html