csgecko Posted January 15, 2007 Posted January 15, 2007 (edited) Hey there guys, I had a question that's been confusing me lately and I apologise if it seems stupid, but at the moment I am just experimenting with batch scripts, and I came across a small prob which I haven't been able to figure out yet.Heres a brief example:Lets say I made a batch file on my C:\ and called it "make.bat" and I wanted it to produce the following below, into another batch file, "C:\test\run.bat" so the new file (run.bat) will contain only:" echo Hello world. >> C:\DOCUME~1\ALLUSE~1\Desktop\Readme.txt " ...without speech markswhat would I put in the original batch file (make.bat), to create that?, so basically, what I would want is:1.) You run "C:\make.bat"2.) "C:\make.bat" creates "C:\test\run.bat"3.) When "C:\test\run.bat" is executed is creates Readme.txt on your desktop.i've already tried:echo "echo Hello world. >> C:\DOCUME~1\ALLUSE~1\Desktop\Readme.txt" >> C:\test\run.batbut then C:\test\run.bat is created with speech marks inside it, which then makes the batch file unable to work..I know it seems kind of confusing but i'd appreciate any help. Thanks in advance.- Jason Edited January 15, 2007 by csgecko
eyeball Posted January 15, 2007 Posted January 15, 2007 couldnt you have make.bat xcopy the other 2 files from a network share that everyone has access to? instead of it creating them?
csgecko Posted January 15, 2007 Author Posted January 15, 2007 Well basically, all I wanted to do was to make a batch file for my friend, so when he runs it, it creates a batch file in his startup folder, which creates the readme on his desktop everytime the comp starts up.
eyeball Posted January 15, 2007 Posted January 15, 2007 oh i see so your not in a domain environment then.i think maybe a vb script would be better suited for this task.. as to how to do it though, you'll have to ask someone else im afraid, im really rusty on VB, havent looked at it in ages lol
Yzöwl Posted January 15, 2007 Posted January 15, 2007 Try something like this1:@ECHO OFF2:IF NOT EXIST C:\TEST MD C:\test3:PUSHD C:\TEST4:>run.bat ECHO/^>"C:\DOCUMENTS AND SETTINGS\ALL USERS\DESKTOP\Readme.txt" ECHO/Hello world5:RUN.BATRemove the line numbers from all 5 lines before you attempt to run it
csgecko Posted January 16, 2007 Author Posted January 16, 2007 That's working perfect, thanks to both of you for helping! - Jas`
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now