1.

Solve : Batch File Change Directory?

Answer»

Ok I'm not using DOS but I am using batch files through windows xp command prompt.

but my PROBLEMS I'm working on pertain to the command line codes.

This one I'm working on now is probably not possible so I DECIDED to bring it to you to confirm.

In my batch I want to access the current user desktop.
This is a MULTIUSER environment in which the computers and their profiles get messed up a lot.

So there are some that have a name I could use to assume it's the right one or they may have that name with .000 .001 .workstation or various other things appended to it.

So is there a WAY to have a batch file goto something LIKE

cd c:\documents and settings\current user\desktop

any ideas at all?cd c:\documents and settings\current user\desktop

Almost. Substitute %username% for "current user"

SWEEEEET thanksFrom where can i get the list of all these user specific variables. Type set on the cmd and you see all variables.

uliOops,

So silly of me. I have another question related to this kind of.

I want to run a batch file that calls two other batch files in a different directory.

But I'm using a pen drive. So on 2 different computers the drive name would be different is there a way to get it to call the current device rather than a set device path?
I'm not aware of a way to do this in batch. Even a script solution where you could equate a volume name to a drive letter is no guarantee. It would only work if the pen drives had the same volume name.

You are probably SOL on this one.

I think SUBST can come to your help.

Do a cd .
This will give you the current directory.
Parse that string to get the drive.

Now use the Subst to assign a different drive letter.
Now with this call your scripts.

What do you think?



Discussion

No Comment Found