Computing.Net > Forums > Windows XP > Need some help creating a batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need some help creating a batch file

Reply to Message Icon

Name: subhash chandra
Date: August 2, 2009 at 12:44:00 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hello Guys ,
I am trying to create a dos program .
With the help of this we can add a reminder in windows XP.
At the specified time a POP-UP Command windows will come up and show the messge provided by you.

It all works fine when i create two batch files and put them in system32.

What i would like to do is to create a single batch file name createalarm.bat.

When i run it should create 2 saprate batch files in system32. 1) alarm.bat 2) showalarm.bat


Please go through below script..

@ECHO OFF
echo @ECHO OFF>>%systemroot%\system32\alarm.bat
echo Title **************Pop-up Reminder by Subhash Chandra************************>>%systemroot%\system32\alarm.bat
echo Color f>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo setlocal>>%systemroot%\system32\alarm.bat
echo set /p tm= Enter the time to set the Reminder :>>%systemroot%\system32\alarm.bat
echo set /p ds= Input the description for this Reminder :>>%systemroot%\system32\alarm.bat
echo ECHO reminder successfully Set at %tm% to %DS%>>%systemroot%\system32\alarm.bat
echo at %tm% /interactive "cmd.exe" /k showalarm "%DS%">>%systemroot%\system32\alarm.bat
echo set /p ent=Press Enter to Exit………>>%systemroot%\system32\alarm.bat
echo exit>>%systemroot%\system32\alarm.bat
echo Title **************Pop-up Reminder by Subhash Chandra************************ >>%systemroot%\system32\showalarm.bat
echo Color f >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo %1 >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo echo. >>%systemroot%\system32\showalarm.bat
echo set /p ent= Press Enter to exit ........ >>%systemroot%\system32\showalarm.bat
Set /p ddnkn= Press enter to exit


This will create a file named alarm.bat and another named showalarm.bat in system 32.

Both files are being created but in both of them at line echo "at %tm% /interactive "cmd.exe" /k showalarm "%DS%"">>%systemroot%\system32\alarm.bat" the {%} is not showing in output file.

ANy help will greatly appriciated.

Thanks in advanced.

Subhash Chandra.

Subhash Chandra.



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: August 2, 2009 at 16:11:20 Pacific
Reply:

Both files are being created but in both of them at line echo "at %tm% /interactive "cmd.exe" /k showalarm "%DS%"">>%systemroot%\system32\alarm.bat" the {%} is not showing in output file.

In order to echo % you must double it up such as %%DS%%

Suggest you could reduce your coding by using something like:

(
echo @ECHO OFF
echo Title **************Pop-up Reminder by Subhash Chandra************************
echo Color f
echo echo.&echo.&echo.

echo setlocal

echo set /p tm= Enter the time to set the Reminder :
echo set /p ds= Input the description for this Reminder :
echo ECHO reminder successfully Set at %tm% to %DS%
echo at %tm% /interactive "cmd.exe" /k showalarm "%DS%"
echo set /p ent=Press Enter to Exit………
echo exit
)>>%systemroot%\system32\alarm.bat

Instead of:


echo @ECHO OFF>>%systemroot%\system32\alarm.bat
echo Title **************Pop-up Reminder by Subhash Chandra************************>>%systemroot%\system32\alarm.bat
echo Color f>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo echo.>>%systemroot%\system32\alarm.bat
echo setlocal>>%systemroot%\system32\alarm.bat
echo set /p tm= Enter the time to set the Reminder :>>%systemroot%\system32\alarm.bat
echo set /p ds= Input the description for this Reminder :>>%systemroot%\system32\alarm.bat
echo ECHO reminder successfully Set at %tm% to %DS%>>%systemroot%\system32\alarm.bat
echo at %tm% /interactive "cmd.exe" /k showalarm "%DS%">>%systemroot%\system32\alarm.bat
echo set /p ent=Press Enter to Exit………>>%systemroot%\system32\alarm.bat
echo exit>>%systemroot%\system32\alarm.bat


Same sort of thing could be done for ShowAlarm.bat

Good luck.


0

Response Number 2
Name: subhash chandra
Date: August 2, 2009 at 16:22:41 Pacific
Reply:

Hmmm.

I was just lost the hope that I can do it!!

I learned 2 things now,

first the way you reduced the script was amezing and second the %% %% thing.

I dont have word to say ( just Thank you is not enough )
I really really appreciate your help.


YOU ARE THE BATCH GURU...

Subhash Chandra.

Subhash Chandra.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Need some help creating a batch file

need help with a batch file www.computing.net/answers/windows-xp/need-help-with-a-batch-file/142147.html

Need help creating a batch file www.computing.net/answers/windows-xp/need-help-creating-a-batch-file/172372.html

Batch file to put create date www.computing.net/answers/windows-xp/batch-file-to-put-create-date/179127.html