Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to create infinite variables in batch files?  (Read 8235 times)

0 Members and 1 Guest are viewing this topic.

J-ho

  • Guest
How to create infinite variables in batch files?
« on: July 05, 2004, 05:12:11 PM »
hi, i'm using DOS (net send)to chat with my flatmate on my LAN, and i've made a simple .bat file that looks like this, so that i don't have to write everything out everytime:

@echo off
net send name %1 %2 %3 %4 %5 %6 %7 %8 %9

the problem is that i can't get any more than 9 variables because if i type %10, it just sends the first one and adds a zero, and i can't write more than nine words! Is there a solution to this, or a better way of doing it? My DOS skills are ten years old, and I don't remember anything on how to write code. Please help!

2k dummy

  • Guest
Re: How to create infinite variables in batch file
« Reply #1 on: July 05, 2004, 06:38:08 PM »
Use the shift command. %0 through %9 are the first ten variables. Using shift, all variables after the tenth are shifted into %9. There is no backward shift, so make sure to type them correctly or create a notepad file with all the names typed in. Save it to the desktop, then copy/paste into the command line for the batch file.  You can use the shift command with less than ten variables.

Yenz

  • Guest
Re: How to create infinite variables in batch file
« Reply #2 on: July 13, 2004, 06:51:33 AM »
use quotes
this way all your text will be in the first variable