I am trying to create a simple batch file that runs a game in a requested directory that the batch file is not in. However, the file directory I want to run from contains spaces. Therefore it does not work. How can I represent a space of a directory in batch so it understands. Here is the code that I have. (Sorry if it’s too long… lol)
no the old way is only 8 charictors per directory or file name and 3 for extension.
the first 6 letters are as usual, the 7th and 8th have to be ~1… so basically it will work for documents and settings, and program files because the space is after the 8th charictor.
There’s a whole bunch of environment variables in Windows that you can use. One of them is %USERPROFILE% , which expands to the full path to get into the user directory. I’d recommend not to use the user name only, because Vista users have their %USERPROFILE% (by default) set to C:\Users\UserName instead of C:\Documents and Settings\Blah\Blah
To see more environment variables, open up a command prompt (not DOS, there is no DOS in Windows NT based systems), and type “set”. Normally, that’s the command for "set"ting a new or modify an existing environment variable, but if you use it without arguments you’ll get a nice listing of all variables available. You might recognize some of them if you ever looked into the Windows system properties dialog
All versions of Windows until 98, 98se and ME were based on (layered on top of) MS-DOS, the NT based versions (including 2k, xp, vista) of Windows are not based on MS-DOS and the command shell is just a program in which you can use DOS commands. Nothing like MS-DOS in there…
Even “ver” tells you it’s Windows
Also, there are so many new commands since MS-DOS… you can open files from a network, you can use ftp, you can query driver properties, query system information, convert partitions, manage running tasks, etc. I wouldn’t say that’s MS-DOS anymore.
Anyway, this is all just nitpicking, who cares anyway
There is no “C:\Windows\Program Files”
Better use %SystemDrive% instead.
I’m not sure if there’s any recommended way to get the program files directory, but I do know you’re not supposed to go there.
(especially on more recent versions of Windows where things can be blocked)
I’m not sure if there’s any recommended way to get the program files directory, but I do know you’re not supposed to go there.
(especially on more recent versions of Windows where things can be blocked)
Bla… it’s just not recommended to go in. If you press view files and folders you can view them anyway. As long as you know what you are doing you are fine. That is just there to stop people that do not know what they are doing from deleting an important system file.
All versions of Windows until 98, 98se and ME were based on (layered on top of) MS-DOS, the NT based versions (including 2k, xp, vista) of Windows are not based on MS-DOS and the command shell is just a program in which you can use DOS commands. Nothing like MS-DOS in there…
Even “ver” tells you it’s Windows
Also, there are so many new commands since MS-DOS… you can open files from a network, you can use ftp, you can query driver properties, query system information, convert partitions, manage running tasks, etc. I wouldn’t say that’s MS-DOS anymore.
Anyway, this is all just nitpicking, who cares anyway
You can issue dos commands in Linux, unix, and Solaris too… it just stands for disk operating system. (it dose not stand for M$DOS, PCDOS, or AmigaDOS , when I say it)
Is there a way to delete a directory in Batch? I know you can delete a file by
yea, just do a del directory name it should work just fine for you.
That’s the reason I wrote “DOS commands” (instead of “MS-DOS commands”, which wouldn’t be the right thing to say, indeed) and only about “MS-DOS” when I was talking about how Windows was based on it and all that
The “rmdir” command does it without asking questions by default. For options about removing directory trees, type “rmdir /?”.
You can use the “/?” argument for all commands by the way
“help” is also very useful to see all available commands.
You can also use the deltree command:
deltree DirectoryNameHere /y
the /y will make it so it will not prompt. deltree will only delete an empty directory. you can always just do a CD dirname, then do a del*.*, then a cd …, then the deltree.
some people even like the erase command:
erase YourDirNameHere /q /f
OR
del YourDirNameHre /q /f
the /q is quitet mode, so it will not prompt user, the /f is to get even the read only files, so use it with caution.