Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
INPUT "What program do you want to run"; dir$
OPEN dir$ FOR OUTPUT AS #1
And nothing opened. I've tried this before, with the same result. I have Windows XP. Is this why it's not working? Please e-mail me the response at bpeters@burntmail.com, because I won't check back here. Thanx.
-----------------
Sometimes I question myself if I am sane.
The simple answer is: you need to open dir$ for INPUT, not "output".
But, your input line implies that you're wanting to run an executable, in which case the line should look more like:
INPUT "What program do you want to run"; dir$
SHELL dir$
Just one more thing: I want to copy some files from a CD to the hard drive. Would I do something like this?
MKDIR "C:\QBASIC"
COPY "D:\program1.exe"
I don't even know if the copy command exists. Please reply to bpeters@burntmail.com, I won't check back here. Thanks. I'm really confused. How do you tell Qbasic where to copy it to???
When you use SHELL, you just put between quotes, whatever you'ld type at the DOS command line.
BTW - When you make a post here, just put a check in the box below that says:
"Check this box if you wish to be notified of replies to this topic."
Its all automatic, or better yet, bookmark this thread. One click in your browser, and you're back here. Its easier than opening email. :)
Ok, i know i have no end to questions, but listen to this. Ok, I have this file C:\tacos.txt . i want to copy it to C:\enchilada , but the directory doesn't exist. so, i'd do this:
Its good to see young folk getting in to programming. A couple of my grandkids are almost your age.
Your first example should have worked. Double check your spelling and puntuation, and try it again. I loaded the code just as you have it and it worked. Make sure the file called "tacos.txt" exists in the "C:\" drive.
On your second example, you must separate literal strings from variables. Like so:
INPUT "What drive do you want to install to"; drive$
SHELL "COPY D:\nahco.exe " + drive$ + ":\folder"
What I would do, is build the whole string first, then use it. Also, you may want to create a "default" value, in case the person enters nothing.
INPUT "What drive do you want to install to ";drive$
IF drive$ = "" THEN drive$ = "C"
mypath$ = "COPY D:\nacho.exe " + drive$ + ":\folder"
SHELL mypath$
(I assume you meant "nacho".) ;)
Try that. And keep checking back. I'll be glad to help you as much as I can.
INPUT "What file do you want to copy"; filepath$
dir$ = filepath$ + " C:\DOS"
SHELL dir$
I DID NOT have a folder at C:\DOS. Should I have used MKDIR before? Ok, well, now to the facts. I copied the files ok, but when I looked at the folder, it was not a folder. it said it was a file. no extension. not .exe, .lnk, nothing. really weird.
It is possible to have a file without an extension. If the file u specify does not exist, DOS will create it, so u told it to copy to that file. This also allows copy and rename in one.
By adding a '\' you will fix your problem. This is how u might try it:
INPUT "What file do you want to copy"; filepath$
dir$ = filepath$ + " C:\DOS\"
SHELL "copy" dir$
you can also copy and rename:
copy c:\one.txt c:\one\two.txt
ok, i've run into a problem. in my extraction program, it asks what drive they want to install to. then in one of the extracted files, it refers to another one of the extracted files. so, the point is: can you store information in a textfile (without opening it) and more importantly, 'import' the text into qbasic?
thanks.
------------------------------