简体   繁体   中英

cmd filename as command in cmd.exe

I am probably missing some lingo to find the answer to a question which I believe has probably been posted already, hence my apologies beforehand.

I wrote a cmd script (myCmdFileName.cmd) that changes some IP configurations using netsh. To run it from cmd, I have to be in the same folder of the script and write in the console myCmdFileName.cmd.

As you know, netsh is a commandline application itself, as I would use it like:

netsh [-flags] [-configs]

What I would like to do is to have my cmd file be called just like as if it was an application like netsh, not worrying about whether I am in the file folder, so like this:

myCmdFileName [-flags] [-arguments]

How would I go about doing that in Windows cmd?

Thanks a lot in advance!

为了从任何地方运行myCmdFileName ,它的父文件夹需要添加到 %PATH% ,或者可以移动它/在%PATH%中已经存在的文件夹中创建指向它的符号链接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM