4
Hi I'm fairly new to batch files, so sorry if this question seems stupid but I really need some help.
So I need my batch script to check if it is in a specified folder, say %userprofile%\Desktop
for example. I don't want it to care about its own filename. I have absolutely no idea where to start. I know how to get the current path/filename etc but that's about all I know. How do I make the program compare its current path with the path that I want to see if it's in? Or is there another more efficient method?
What I want to achieve is like this:
if this file is in Desktop folder(
echo It's here
)else(
echo It's not here
)
Any help is appreciated, thanks everyone
Did you check
1https://stackoverflow.com/questions/4419868/what-is-the-current-directory-in-a-batch-file – JavaSheriff – 2018-08-20T15:01:45.497
1@user648026 %cd% will not show the path of the batch file, but only the current directory. The current path is something like %~p0 but I forgot the exact syntax. – LPChip – 2018-08-20T15:01:45.717
see link: https://stackoverflow.com/questions/4419868/what-is-the-current-directory-in-a-batch-file
– JavaSheriff – 2018-08-20T15:02:09.283Possible duplicate of Get current folder name by a DOS command?
– LPChip – 2018-08-20T15:05:06.800My main problem was with the comparing of the paths, but thanks guys – Mantis Tsai – 2018-08-20T15:48:39.893