Computer Hope

Microsoft => Microsoft DOS => Topic started by: Carbon Dudeoxide on February 27, 2007, 04:50:43 AM

Title: create a text file from batch 2 and how to delay
Post by: Carbon Dudeoxide on February 27, 2007, 04:50:43 AM
Earlier I posted a question 'How can I make a text file from a batch file'
http://www.computerhope.com/cgi-bin/yabb/YaBB.cgi?num=1171809714
I found out how to do it.
Here is a small example of how I plan to use it:

How to create a file from a batch file
:1
@echo off
cls
echo.
echo. Please choose an option
echo.
echo. 1. Save a readme on the desktop.
echo.
set /p a=:
if /I %a%==1 goto :2
:2
@echo off
echo.This is the readme, I just >>C:\Docume~1\%username%\desktop\readme.txt
echo.have to put text here >>C:\Docume~1\%username%\desktop\readme.txt
echo.and it works. lol >>C:\Docume~1\%username%\desktop\readme.txt
cls
echo.
echo. The readme has been saved to your desktop
echo.
pause
goto :1

Try it out  :)

Question:
Is there any way to put like a 3 second delay so i don't have to 'press any key to continue'??
Title: Re: create a text file from batch 2 and how to del
Post by: lordoftheplat on February 27, 2007, 07:30:45 AM
ok try this

:1
@echo off
cls
echo.
echo. Please choose an option
echo.
echo. 1. Save a readme on the desktop.
echo.
set /p a=:
if /I %a%==1 goto :2
:2
@echo off
echo.This is the readme, I just >>C:\Docume~1\%username%\desktop\readme.txt
echo.have to put text here >>C:\Docume~1\%username%\desktop\readme.txt
echo.and it works. lol >>C:\Docume~1\%username%\desktop\readme.txt
cls
echo.
echo. The readme has been saved to your desktop
echo.
PING Insert 3=(4-1) second delay
goto :1


it should work i think
but one thing ur original one doesnt work properly it does not create a readme file nor edits the readme file....
i even changed the file root to C:\
but still it doesnt work
Title: Re: create a text file from batch 2 and how to del
Post by: WillyW on February 27, 2007, 09:50:25 AM
Quote

Is there any way to put like a 3 second delay so i don't have to 'press any key to continue'??


Yes.

An option:
Read this thread - http://www.computerhope.com/cgi-bin/yabb/YaBB.cgi?num=1168025488/8#8
It is about introducing a wait time.

There is a file attached to a post in that thread.   You might like to download it and keep it for your future use, even if you decide not to use it for this current project.



Another option:
Probably better -  
Check out:  http://www.computerhope.com/choicehl.htm
That is about the    choice   command.
It tells you how to use it.
Be sure to note the  /T  option.
Also, at the command line on your computer,  you can type
choice /?     and hit enter.
It should respond with some brief help on the choice command.

I hope this helps.


Title: Re: create a text file from batch 2 and how to del
Post by: Carbon Dudeoxide on February 27, 2007, 03:39:56 PM
If it doesn't work lordoftheplat, try this:

@echo off
echo.If this is on your desktop then it should work >>C:\Docume~1\%username%\desktop\readme.txt
exit.

This should create a text file on your desktop with the text inside.
It works for me on XP...
Title: Re: create a text file from batch 2 and how to del
Post by: Carbon Dudeoxide on February 27, 2007, 08:38:32 PM
Oh right, thanks WillyW for the delay file. If i use that, it wont work on other computers will it? because the other computers would need that file in system32.
Title: Re: create a text file from batch 2 and how to del
Post by: lordoftheplat on February 28, 2007, 05:05:44 AM
dudeoxide still doesnt work some how maybe its cause im running on a stupid
stupid stupid coputer
windows XP home 2002
Title: Re: create a text file from batch 2 and how to del
Post by: Carbon Dudeoxide on February 28, 2007, 05:27:39 AM
Hey! i'm running on Windows XP Home 2002 too ok, don't diss, lol :P
It works on my computer and on my other computer which is XP Pro so I don't know why yours isn't working....
Title: Re: create a text file from batch 2 and how to del
Post by: WillyW on February 28, 2007, 10:43:51 AM
Quote
Oh right, thanks WillyW for the delay file. If i use that, it wont work on other computers will it?

"it" ??
What is "it"?
Your batch file or the  wait  program?

If you give someone else your batch file to try on their computer, and they do not have the   wait program,  then of course the batch file would not work properly if it is calling the wait program.

If you give someone else both your batch file and the wait program, and they put them all in their proper places,   then yes,  it should work.

Quote
because the other computers would need that file in system32.

The wait program file would need to be in the path or the current directory, so that it could be executed.
By your above statement,  it would seem that your   \system32 directory is in your path.


Title: Re: create a text file from batch 2 and how to del
Post by: WillyW on February 28, 2007, 10:45:35 AM
Quote
Oh right, thanks WillyW for the delay file. If i use that, it wont work on other computers will it? because the other computers would need that file in system32.

Also -
be sure to see my first post above regarding:
Quote
Another option:
Probably better -  

Title: Re: create a text file from batch 2 and how to del
Post by: userid on February 28, 2007, 03:05:48 PM
Hey can someone make a batch file that will make 1000s o txt files that have a differmnt name each time on  my desktop like a prank once  i press enter.

and make it send via wlm it gets blocked
Title: Re: create a text file from batch 2 and how to del
Post by: Carbon Dudeoxide on February 28, 2007, 03:38:44 PM
I think i got something like Displayname. I got a batch file like with the command
@echo off
md

Then after the 'md' i pasted several essays so it would create a couple hundred folders on my desktop.

Here is an example of the command:

@echo off
md 1 2 3 4

This would make 4 folders wherever your batch file is, each folder named 1, 2, 3 or 4.
It's actually kinda fun :P
Title: Re: create a text file from batch 2 and how to del
Post by: fffreak on February 28, 2007, 03:49:59 PM
Quote
Hey can someone make a batch file that will make 1000s o txt files that have a differmnt name each time on  my desktop like a prank once  i press enter.

and make it send via wlm it gets blocked

Use with !!caution!! because this takes awhile to clean up.

Code: [Select]
FOR /L %%G IN (0,1,1000000) DO echo %%G >> %%G.txt
Save as filename.bat, then just open it.
Title: Re: create a text file from batch 2 and how to del
Post by: Carbon Dudeoxide on February 28, 2007, 10:27:56 PM
before i try that too, does it create txt files in the directory the batch file is in?
Title: Re: create a text file from batch 2 and how to del
Post by: fffreak on March 01, 2007, 07:10:43 AM
Yes, it does.
Title: Re: create a text file from batch 2 and how to del
Post by: lordoftheplat on March 01, 2007, 07:18:35 AM
kewl...if i didnt do this hwk...
i say itz on my usb...
i go on the teacher's comp
and i use that program...
i wonder wad the teacher would say....