|
|
|
Batch file variable creation
|
Original Message
|
Name: ham30
Date: July 21, 2006 at 12:00:57 Pacific
Subject: Batch file variable creationOS: WinXP Home Sp2CPU/Ram: AMD 2000/512mbModel/Manufacturer: generic |
Comment: I need to learn how to create a batch file variable of a file or folder name to use several times later in the batch file. I've tried several ways and haven't figured out how to do it. One example that didn't work was: set /p Name=file1.dat mkdir c:\%Name% Can someone show me the correct way? And also a link to a good XP batch tutorial would be very helpful. I found one ( http://www.ss64.com/ntsyntax/index.html), but it wasn't enough help. Do yourself a favor BACKUP!
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: ham30
Date: July 21, 2006 at 12:11:55 Pacific
Subject: Batch file variable creation |
Reply: (edit)Jeez, I'm a dummy! Change the above trial to: set /p Name=Folder1 mkdir c:\%Name% That looks more logical. Do yourself a favor BACKUP!
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: ham30
Date: July 21, 2006 at 13:41:00 Pacific
Subject: Batch file variable creation |
Reply: (edit)Nevermind, sorry to bother you. I removed the '/p' and it worked. Do yourself a favor BACKUP!
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Shr0Om
Date: July 21, 2006 at 15:18:11 Pacific
Subject: Batch file variable creation |
Reply: (edit)You use /p if you want some input assigned to the variable. i.e user input set /p Name=What is your name?: echo Hello %Name% & pause file input set /p Variable=<Somefile.txt This would assign the string from the first line of the txt file to the variable. If you google for "batch file tutorial" im sure you will find some useful pages
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Mechanix2Go
Date: July 21, 2006 at 17:20:33 Pacific
Subject: Batch file variable creation |
Reply: (edit)Hi ham30, Sadly, most sites I've seen are either rather trivial or so arcane that they're for freaks only. Much depends on what stage of the journey you're in. One individual whose work helped me was Laura Fairhead. In NT CMD many things which were ball breakers in DOS are relatively simple. ===================================== If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: ham30
Date: July 21, 2006 at 19:40:20 Pacific
Subject: Batch file variable creation |
Reply: (edit)Thanks guys. Yeah Shr0Om I finally figured out that I didn't want the /p. I had misinterpreted the instructions on that web site. I've Googled for batch file tutorial and seemed to get nothing but old DOS batch file help. I Googled for "XP batch file tutorial" and only found the one. Anyway, I got the job done that I was working on. Hi Mechanix, I checked out Laura Fairhead's web site. She has several batch files to get ideas from, thanks. I did a little simple DOS batch file creating many years ago, but I'm really rusty and my mind isn't what it used to be. I've decided not to try learning the new NT batch stuff. Do yourself a favor BACKUP!
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: Shr0Om
Date: July 23, 2006 at 07:50:45 Pacific
Subject: Batch file variable creation |
Reply: (edit)M2: I checked out Laura Fairhead's site aswell.. Pretty harcore batch programming there.. Like, a chess game written entirely in batch.. Pity it wont work under XP, i would like to see how it works. Also enjoyed those graphics demos written in assembly. Amazing how they do that s---..
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: tonysathre
Date: July 26, 2006 at 09:53:24 Pacific
Subject: Batch file variable creation |
Reply: (edit)Wow, I think I'm going to install DOS on one of my old boxes just so I can see some of those batch files at work. That chess script is the most complex batch programming I've ever seen. UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|