1.

Solve : how to make string for a commond??

Answer» 1. to run the commonds in dos i do have to switch to system32 directory each time when i open dos window. is there any way to come out from this issue so that it WOULD been possible to run commonds directly without switching again and again.
although i know that this can be achieved by setting path variable to point to system32.
but this variable already has been set already to point to java home directory as per my requremet.

2. how can i define a string for a commond

suppose this is a commond C:\> cd c:\windows\system32 now i want that this commond would work as such if i write C:\> string


regards
san


1)I dont fully understand the question, if you understand you need a variable and one has already been set, why not just set another?

2)so instead of typing C:\windows\system32\batfile.bat , you just want to type batfile.bat , this can be done by placing the batch file inside the windows folder, and if that doesent work TRY windows\system32 folder.Quote from: diablo416 on May 08, 2008, 07:44:22 AM


1)I dont fully understand the question, if you understand you need a variable and one has already been set, why not just set another?

yes!! isn't it possible to define two seprate variables such that both of them work?
please read my problem again

Quote
2)so instead of typing C:\windows\system32\batfile.bat , you just want to type batfile.bat , this can be done by placing the batch file inside the windows folder, and if that doesent work try windows\system32 folder.

i meant how to define a small string for a lengthy commond?Quote
although i know that this can be achieved by setting path variable to point to system32.
but this variable already has been set already to point to java home directory as per my requremet.

The path variable can point to multiple directories by separating them with semi-colons.

path=c:\java\directory;c:\windows\system32;c:\windows;

After checking the current directory, the path is searched reading left to right. If a match is found, execution begins, if not you get the dreaded "is not recognized as an internal or EXTERNAL command, OPERABLE program or batch file."

Many programs add themselves to the path when installed. You can also add your own directories so you don't have to store your own stuff in the Windows directories.

The path also works with the pathext variable when files in a directory have the same name but different extensions.

thanks!!

and what about my second question?

Quote
how can i define a string for a commond

suppose this is a commond C:\> cd c:\windows\system32 now i want that this commond would work as such if i write C:\> string

Put it in a batch file called string.bat, put the batch file in a folder on the PATH and then you can just type string

for example

s32.bat

Code: [Select]@echo off
cd "c:\windows\system32"

Now if you type s32 at the command prompt the effect is the same as if you had typed cd "c:\windows\system32"

The power of batch files!

PS the word command has an 'a' in it. Hmmm... somebody else was in the habit of spelling it "commond"...







Discussion

No Comment Found