windowsbatch-filecmdwindows-2000

Batch file "to many command-line parameters"


So, for Windows 2000, I'm making kind of a program spammer thing. There is another batch file, that, at the end, calls in the program spammer file. The problem I'm having is adding it saying "to many command-line parameters". This is the current code I have to add it to startup.

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v begin-second /t REG_SZ /f /d C:\Documents and Settings\%LOCALUSER%\Desktop\bat script\begin-second.bat

The rest of the script consists of lines like this:

start <EXE file in system32 or WINNT openable by Run>

And there are a few of these "ping" commands serving as a pause in the program for a selectable amount of time:

ping 1.1.1.1 -n 1 -w 1000>nul

Can somebody help me here? The code to add it to the startup throug the registry probably has something wrong with it. When I launch the .bat file, it just spams the programs. I have Registry Editor open, but nothing changes in this directory, the same one the command uses to write the SZ key to the registry, at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.

I'm kind of a person learning Batch, so it's pretty obvious why I'm having issues. I'm not experienced enough. What I'm looking for is a workaround, or something to fix this "to many parameters" thing. Also, remember, I'm programming this in Windows 2000.


Solution

  • You need to put your data (after the /d) in quotes, or else it will interpret the spaces in the filename as separators between different parameters.