Home / Microsoft / Microsoft DOS / How to create infinite variables in batch files?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: How to create infinite variables in batch files?  (Read 2142 times)
J-ho
Guest
« 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!
IP logged
2k dummy
Guest
« 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.
IP logged
Yenz
Guest
« Reply #2 on: July 13, 2004, 06:51:33 AM »

use quotes
this way all your text will be in the first variable
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / How to create infinite variables in batch files? « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 5.086 seconds with 18 queries.