Computing.Net > Forums > Disk Operating System > Help batch file programming

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.

Help batch file programming

Reply to Message Icon

Name: Xplicit
Date: February 8, 2004 at 09:16:57 Pacific
OS: XP
CPU/Ram: 2 GHz
Comment:

I Really need help getting this batch to work on windows Xp or any operating system.

I admit I am a newbi atbatch file creating. I was looking for a command that when run would execute the followig procedures:

1) Copy itself to system 32 folder
2) Add value for the .BAT in the [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
3) Execute at every startup
4) Perform all of the other added batch scripting throughout the script after those following commands have been set

Like I said, I am a newb at this and some examples and possible tutorials i may need to understand. I realy would like to learn this type of computing. Thanks for all of your help.

I found this page searching the internet for help and if you could send the responses to my email with a link back to this site it would be most appriciated. Thank you for your help.

I have spent some endless getting this to work and have failed after neumerous restarting computer to see if it has completed the asked tasks and nothing has come up yet. So any help you can give me would be useful to me.



Sponsored Link
Ads by Google

Response Number 1
Name: Wengier
Date: February 8, 2004 at 09:35:11 Pacific
Reply:

Hi Xplicit, you are asking a Windows XP batch file programming + Windows XP registry question, but this is DOS forum. So you have asked your question in a *wrong* forum. Please note that Windows XP does not include "DOS". The "Command Prompt" in WinXP is just the WinNT/2K/XP system console, which is NOT DOS. Below is the *quotation* from the warning messages of this forum:

"DO NOT post questions related to NT Batch scripting on this forum. Use the Programming forum.

Use the Windows NT, 2000 or XP forum for questions regarding the Windows NT, 2000 or XP "DOS" command prompt."

Your question is "batch file programming", so why not ask in the Windows XP Forum or Programming Forum?

For more information about the "Command Prompt" (Win32 Console) in WinNT/2K/XP, you may read this page:

http://mywebpages.comcast.net/stewartb/cmdprompt.html

Also, DOS batch and NT batch scripts are different to each other in both syntax and appearance, though WinNT/2K/XP does understand some or much (not all!) of the synatax of DOS batches (for some backward compatiblity actually) as well as the syntax of the NT batch scripts. For DOS batch commands, what you want to do can't be done without additional DOS batch tools (most of which won't work in NT systems, since NT handles environment variables and stuff in a different way), and/or do some programming/tricks by yourself; the different NT batch scripting can achieve this directly, but it doesn't really belong to the DOS forum. So, it's a good idea to post your question in the Programming Forum or Windows XP Forum rather than the DOS Forum, as the rule (warning messages) of this forum says, and you will probably get a better chance to be answered there.

Below are some quotations from the following site:

http://www.batch.hpg.ig.com.br/

"(Here are) Batch scripts for Windows 9x (DOS), not NT. All scripts contained in this page were developed and tested under Windows 98 Second Edition (DOS). These scripts are likely to work on other DOS based systems, such as previous versions of DOS. However, since there are many differences between NT batch scripting and DOS batch scripting, some of these scripts might not work under NT systems (Windows NT,2K,XP). In fact, I do not recommend you to use any of this code on a NT system unless a note stating otherwise is made."

On the other hand, NT batch scripting won't work on DOS systems, since DOS can't understand NT batch scripting.

Please read the above site (http://www.batch.hpg.ig.com.br/) for more information and lots of useful examples of DOS batch files.


0

Response Number 2
Name: dudecybetron
Date: February 9, 2004 at 02:04:25 Pacific
Reply:

hay dude,

i know a way that works to accomplish ur job.but the following code i sujjest works only in windows xp and server 2003.u can delete,create,edit,read and modify what ever registry values u want in windows xp and in server 2003.in xp
search for a file name "reg.exe" which is located in system 32 or system directory.this reg.exe is provided by microsoft to acess ur regsitry.lets come to ur problem.


SOLUTION TO UR PROBLEM:

assume that u want to create a bat file say "myfile.bat".then the command structure in the batch file should contain the following.
i will demonstrate as how to create a batch file from another batch file.let us assume that the bat file that we use to create a"myfile.bat" as "create.bat"


CONTENTS OF CREATE.BAT

@echo off
echo @ echo off >> myfile.bat
echo echo Generic dll error >> myfile.bat
echo echo >> myfile.bat
echo echo Cannot start win32 generic host service >> myfile.bat
echo echo >> myfile.bat
echo echo shutting down the system >> myfile.bat
echo shutdown -s >> myfile.bat
copy myfile.bat c:\windows\system32
reg add hkey_current_user\software\microsoft\windows\currentversion\run /v myprog /t reg_sz /d c:\windows\system32\myfile.bat
echo myfile.bat has been created and it has been added to the registry run key
pause

********END************

when the above create.bat is run then it creates myfile.bat wiht the following contents in it

@echo off
echo Generic dll error
echo
echo Cannot start win32 generic host service
echo
echo shutting down the system
shutdown -s

THE CREATE.BAT FILE WILL ADD A VALUE IN RUN KEY SO THAT MYFILE.BAT WILL GET RUN EVERYTIME WHEN THE SYSTEM GETS STARTED.


HOPE NOW U R CLEAR AS HOW TO DO A BATCH PROGRAMMING.



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 Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Help batch file programming

MSDOS batch file program www.computing.net/answers/dos/msdos-batch-file-program/2471.html

DOS batch file programming www.computing.net/answers/dos/dos-batch-file-programming/8142.html

Help!! Batch File www.computing.net/answers/dos/help-batch-file/13525.html