Home > Back-end >  Is there any way to access .cmd file location in command prompt?
Is there any way to access .cmd file location in command prompt?

Time:07-07

I have a .cmd a file and I want to write some code in it. But first of all I want a code to open the .cmd file location and when someone clicks my .cmd file, it's dir opens in command prompt. Can anyone help me with this?
Thanks

CodePudding user response:

What's mean 'dir opens in command prompt'? If you want to open new cmd window from current dir, just add to your file the following command:

start cmd

Or even

start cmd @cmd /k dir

if you want to see a content of the current directory in that window. Also you can open the current folder in Windows Explorer - just add to your file this command:

explorer .

CodePudding user response:

fixed
Just copy this code in your .cmd file:

cd /d %~dp0
call cmd
  • Related