1.

Solve : finding current folder in and setting it?

Answer»

As the topic reads, i need to find the folder that batch is CURRENTLY in. Then i need to set it to something like %opath%

the current folder is already set to CD , %CD%There is a DIFFERENCE between the "current folder", which is usually taken to mean the currently logged in folder, which is %cd%, and the folder where the batch file is ACTUALLY located, which is %~dp0 and which is not necessarily the same as the current folder.

For example consider a batch file containing these lines called test.bat which is stored in the folder d:\batch

echo 1...%cd%
echo 2...%~dp0

I open a command PROMPT and type cd c:\

Now c:\ is the current folder but if i type this

d:\batch\test.bat

I will see this output

1...C:\
2...D:\batch\test

That's exactly what I needed Dias de verano! Thanks



Discussion

No Comment Found