Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 12-18-08   #1 (permalink)
Intel Overclocker
 
hoth17's Avatar
 
intel nvidia

Join Date: May 2007
Location: Cal Poly, SLO
Posts: 2,184

Rep: 133 hoth17 is acknowledged by manyhoth17 is acknowledged by many
Unique Rep: 110
Trader Rating: 44
Default .bat help

I am trying to make a batch file which asks the user to enter a file name and some text and is saves it in a .txt file. I can make the file and have words in it, but i do not know how to let the user choose the filename through use of a variable, or enter their words also through a variable. This is a school project, so any help is greatly appreciated. here is what i have

ECHO Enter the name of the file:

rem here is where i want to retrieve inputed data and store it the variable "Filename"

ECHO Enter the data you want in your text file:

rem here is where i want to retrieve data and store it in a variable "words"

ECHO Words>>C:\files\filename.txt

System: My system
CPU
-
Motherboard
-
Memory
-
Graphics Card
-
Hard Drive
WD 640 AALS | WD 250 Backup
Sound Card
X-fi Titanium Fatal1ty
Power Supply
Corsair 1000HX
Case
-
CPU cooling
-
GPU cooling
-
OS
Windows 7 x64 | Arch Linux
Monitor
Dell 24" 1920x1080
hoth17 is offline   Reply With Quote
Old 12-19-08   #2 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,456

Rep: 141 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

Give me a minute. Plus bumbzors.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 12-19-08   #3 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,456

Rep: 141 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

Code:
SET /P file=Choose Name:
SET /P location=Choose Location:

CD %location%

MKDIR %file%
It's ugly but it works.

That just makes a file! Let me fix it.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD

Last edited by GodofGrunts : 12-19-08 at 11:44 AM
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 12-19-08   #4 (permalink)
.
 
BiG O's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: Virginia
Posts: 3,590

Trader Rating: 4
Default

Quote:
Originally Posted by GodofGrunts View Post
Code:
SET /P file=Choose Name:
SET /P location=Choose Location:

CD %location%

MKDIR %file%
It's ugly but it works.

That just makes a file! Let me fix it.
All you're doing is making a folder somwhere. I don't think that's what he wants. Gimme a sec, and I'll write it.

Code:
@echo off
SET /P file=Choose Name:

SET /P text=Enter Text to be added to file:

echo %text%>>%file%
there you go. It just makes it in the same directory as the batch file. You can add a location like GodofGrunts, and cd there, then run the last step, if you want that functionality. Make sure when you type in filename, you use the .txt extension on the end, or the program won't know what kind of file it is.
__________________
Imaging with Windows PE
Please keep the OCN Terms of Service in mind when posting.

System: My System
CPU
Q6700
Motherboard
Gigabyte p35-DS4
Memory
8GB Crucial Ballistix DDR2-800 (4x2GB)
Graphics Card
BFG 8800GTS 512MB g92
Hard Drive
2X 500GB Seagate Barracuda 7,200 RPM SATA RAID 0
Sound Card
Razer Barracuda AC-1 7.1
Power Supply
ABS 700W Modular
Case
Antec 900
CPU cooling
Apogee GTZ
GPU cooling
Stock
OS
Vista Ultimate x64 SP1, Xubuntu 8.10, Windows 7
Monitor
Hanns-G 28" & Dell 19" widescreen

Last edited by BiG O : 12-19-08 at 11:57 AM
BiG O is offline Overclocked Account   Reply With Quote
Old 12-19-08   #5 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,456

Rep: 141 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

Code:
@echo off
SET /P file=Choose Name:

SET /P location=Choose Location:

SET /P info=Insert what you would like in the file:

CD %location%

ECHO %info% > %file%.txt

ECHO The file can be found at %location%

SET /P seepath=

EXIT
There much better.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD

Last edited by GodofGrunts : 12-19-08 at 12:02 PM
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 12-19-08   #6 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,456

Rep: 141 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

Quote:
Originally Posted by BiG O View Post
All you're doing is making a folder somwhere. I don't think that's what he wants. Gimme a sec, and I'll write it.

Code:
@echo off
SET /P file=Choose Name:

SET /P text=Enter Text to be added to file:

echo %text%>>%file%
there you go. It just makes it in the same directory as the batch file. You can add a location like GodofGrunts, and cd there, then run the last step, if you want that functionality. Make sure when you type in filename, you use the .txt extension on the end, or the program won't know what kind of file it is.
Didn't sleep last night so I'm running on empty. I also haven't worked in command prompt in forever lol. Way to beat me to it. I like mine though.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 12-19-08   #7 (permalink)
.
 
BiG O's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: Virginia
Posts: 3,590

Trader Rating: 4
Default

Quote:
Originally Posted by GodofGrunts View Post
Code:
@echo off
SET /P file=Choose Name:

SET /P location=Choose Location:

SET /P info=Insert what you would like in the file:

CD %location%

ECHO %info% > %file%.txt

ECHO The file can be found at %location%

SET /P seepath=

EXIT
There much better.
That's unnecessary. You can just put pause there. Otherwise, it's fine. Pretty much the same as mine.
__________________
Imaging with Windows PE
Please keep the OCN Terms of Service in mind when posting.

System: My System
CPU
Q6700
Motherboard
Gigabyte p35-DS4
Memory
8GB Crucial Ballistix DDR2-800 (4x2GB)
Graphics Card
BFG 8800GTS 512MB g92
Hard Drive
2X 500GB Seagate Barracuda 7,200 RPM SATA RAID 0
Sound Card
Razer Barracuda AC-1 7.1
Power Supply
ABS 700W Modular
Case
Antec 900
CPU cooling
Apogee GTZ
GPU cooling
Stock
OS
Vista Ultimate x64 SP1, Xubuntu 8.10, Windows 7
Monitor
Hanns-G 28" & Dell 19" widescreen
BiG O is offline Overclocked Account   Reply With Quote
Old 12-19-08   #8 (permalink)
Linux Lobbyist
 
GodofGrunts's Avatar
 
intel nvidia

Join Date: Nov 2007
Location: Hamilton, Ohio
Posts: 2,456

Rep: 141 GodofGrunts is acknowledged by manyGodofGrunts is acknowledged by many
Unique Rep: 116
Trader Rating: 2
Default

oh yeah pause... I've been programming in python and bash for the past 4 or 5 months. That was just a quick fix.
__________________
Quote:
Originally Posted by MrDeodorant View Post
Oh, and the mayonnaise fanboys come out. Go back to your cave, troll. 2mm of mayonnaise is all anyone really needs. You don't have the ketchup bandwidth to support any more.

L2Sammich, noob. Besides, I'm running a Miracle Whip distro.
Click below to show/hide Hidden Text Below!
Quote:
Originally Posted by Raptor_Jesus View Post
Exactly what GodofGrunts said.
Quote:
Originally Posted by GodofGrunts View Post
Exactly what Raptor_Jesus said.
Quote:
Originally Posted by kerbitroy View Post
Exactly what they said :P
Quote:
Originally Posted by GodofGrunts View Post
Exactly what she said.
Quote:
Originally Posted by esocid View Post
Universe asplodes.





System: The Monolith
CPU
Q6600 G0 3.21 GHz
Motherboard
Asus P5K
Memory
4 GB 2x2GB OCZ
Graphics Card
8800GT Alpha Dog Edition 512MB
Hard Drive
WD 500GB Sata
Sound Card
Onboard
Power Supply
600W Ultra
Case
Monolith
CPU cooling
Scythe Ninja 2
GPU cooling
Aftermarket
OS
Mythbuntu 9.04 x64
Monitor
17" Dell LCD
GodofGrunts is offline GodofGrunts's Gallery   Reply With Quote
Old 12-24-08   #9 (permalink)
The Game
 
lattyware's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: In A Faraday Cage
Posts: 2,679

Rep: 281 lattyware is a proven memberlattyware is a proven memberlattyware is a proven member
Unique Rep: 207
Folding Team Rank: 533
Hardware Reviews: 1
Trader Rating: 0
Default

yeah, when you have used Python or even Bash, Batch scripting seems nigh-on hellish. Just no tools at your disposal.
__________________
Lattyware | Main (Sig) Rig: gBOX42 | Lan Rig: gLAN42
Never been convinced by Linux? Here is a challenge. | Using LVM
Scratched Disc? | Guide To LAN Parties | Writing a GUI application in Python/Glade
Etching an image into your case. | Wireless Access Points: Easy wireless networking.
A Member Of The OCN Anime/Manga Club

"I disapprove of what you say, but I will defend to the death your right to say it." --Evelyn Beatrice Hall

System: gBOX42
CPU
Core 2 Duo E6600 @ 3.51GHz
Motherboard
Asus P5B Deluxe/WiFi-AP
Memory
2 x OCZ DDR2 Platinum 1Gb PC6400 C4
Graphics Card
256MB MSI 8600GTS
Hard Drive
2x 1TB SATA, 2 x 500GB SATA
Sound Card
Creative Soundblaster Audigy SE
Power Supply
SEASONIC S12-600
Case
CoolerMaster Cosmos
CPU cooling
XSPC X2O Delta CPU Waterblock V2
GPU cooling
D-Tek FuZion GFX Block
OS
Arch Linux x64
Monitor
Dell 2407WFP, Dell E248WFP
lattyware is offline I fold for Overclock.net Overclocked Account lattyware's Gallery   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 07:11 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.13826 seconds with 8 queries