I would like to know if there i开发者_Python百科s a better way of renaming two files and alternate the names within a batch file. I am currently using this method.
ren httpd.conf temp_httpd.conf
if exist _httpd.conf (
ren _httpd.conf httpd.conf
ren temp_httpd.conf _httpd.conf
)else (
ren _httpd.conf httpd.conf
)
In my opinion the way is ok, but the false-case can't work.
If the file _http.conf doesn't exists, you try to rename it to http.conf.
I would change it to
if exist _httpd.conf (
ren httpd.conf temp_httpd.conf
ren _httpd.conf httpd.conf
ren temp_httpd.conf _httpd.conf
)
精彩评论