Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
My batch file currently creates a folder with the name of the computer, then creates a txt file with the name of the computer in the aforementioned folder. Now what I need to do is get the text "Name of Computer is: %computername% " into that file. I have looked at 'type' and 'copy' but both seem to only work for appending files. How do I append text to the file. As an example (this isn't really the case but demonstrates the same problem with a different application), say I want the user to enter the text; how? Here is the code I am trying to get working:
type "Is this going in?" >> %CD%\Data\%computername%\%file_name%

it Doesn't seem to be working. Could it be that the path is to large? any other ideas?
Also, a few questions
1. When should you use quotes?
(e.g. Call "setup.bat" or w/o quotes?)
(e.g. "@copy nul Data\%computername%\%file_name%" or w/o quotes?)
(e.g. echo "hello!" or "echo hello" or echo hello?)
2. When do you use '>' or '>>'? whats the difference?
3. whats the difference between %1 and %%1?

This works correctly:
echo "Is this going in?" > Data\%computername%\%file_name%Any idea why it doesn't work with the additional %CD%\ master directory? Logically I think it should.
Also, whats the difference between > and >>?

LoL, Okay. The method we have been talking about overwrites the text in the file I need to do this:
@echo COMPUTER NAME: %computername% > Data\%computername%\%file_name%
@echo SCAN DATE: %fdate% > Data\%computername%\%file_name%
@echo SCAN TIME: %ftime% > Data\%computername%\%file_name%but it overwrites the data on each echo. Hmm, wonder if thats where the >> comes in? let me try....... HAHA! I solved my own questions/problems just by talking to myself on this thing! yipi!

If your %CD% contains spaces, use
echo "Is this going in?" >> "%CD%\Data\%computername%\%file_name%"--
Holla.

![]() |
visual voxpro .exe does n...
|
Write the following MS-DO...
|

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