Incorrect filename, directory name, or volume label syntax in batch process
P粉396248578
P粉396248578 2023-08-27 15:10:59
0
2
467
<p>When I run the following command in batch... </p> <pre class="brush:php;toolbar:false;">set PATH='C:UsersDEBDownloads10.1.1.0.4' cd !PATH!</pre> <p>I get the error "The file name, directory name, or volume label syntax is incorrect"</p> <p><strong>Update</strong>: Some solutions worked for me. </p> <ul> <li>Do not use <code>PATH</code> as a variable name</li> <li>Set it to <code>"myPATH=C:UsersDEB DASDownloads10.1.1.0.4"</code></li> </ul><p><br /></p>
P粉396248578
P粉396248578

reply all(2)
P粉463291248

In my case, if I run the batch file using cmd and the batch file path is incorrect, this error will show up, like users>E:\TEST"E:\TEST.batError, users>E:\TEST.bat worked. After checking my path, it was fixed.

P粉184747536
set myPATH="C:\Users\DEB\Downloads.1.1.0.4"
cd %myPATH%
  • Single quotes don't represent strings, they make it start with: 'C:\ instead of C:\ so

    李>
  • %name% is a common syntax for expanding variables. The !name! syntax requires the command setlocal ENABLEDELAYEDEXPANSION, or CMD /V:ON Run command prompt.

  • Don't use PATH as your name, it is the system name that contains the location of all executable programs. If you override it, random parts of the script will stop working. If you plan to change it, you need to do set PATH=%PATH%;C:\Users\DEB\Downloads\10.1.1.0.4 to keep the current PATH contents and add something to the end .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!