Incorrect filename, directory name, or volume label syntax in batch process
P粉396248578
P粉396248578 2023-08-27 15:10:59
0
2
446

When I run the following command in batch...

set PATH='C:UsersDEBDownloads10.1.1.0.4' cd !PATH!

I get the error "The file name, directory name, or volume label syntax is incorrect"

Update: Some solutions worked for me.

  • Do not use PATH as a variable name
  • Set it to "myPATH=C:UsersDEB DASDownloads10.1.1.0.4"


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, likeusers>E:\TEST"E:\TEST.batError,users>E:\TEST.batworked. 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 ofC:\so

      李>
    • %name%is a common syntax for expanding variables. The!name!syntax requires the commandsetlocal ENABLEDELAYEDEXPANSION, orCMD /V:ONRun 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 doset PATH=%PATH%;C:\Users\DEB\Downloads\10.1.1.0.4to 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!