0

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.

VeeTHis
  • 25
  • 4

1 Answers1

0

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.

Cuagau
  • 548
  • 3
  • 7
  • Would there be anything wrong with %LOCALUSER%? It looks weird to me... – VeeTHis Jun 13 '17 at 01:50
  • It depends on whether %LOCALUSER% is set to something in your script's. You can check with `echo %LOCALUSER%` in your script. If you just want the current user's username, you can use %USERNAME%, or you can use %HOMEPATH% to get the full path to the current user's home directory. – Cuagau Jun 13 '17 at 03:24
  • You'd need both `%HOMEDRIVE%` and `%HOMEPATH%`; or you go for `%USERPROFILE%`; anyway, you still need to surround this with quotes... – aschipfl Jun 13 '17 at 11:44