The filename, directory name, or volume label syntax is incorrect 0 file s copied

Hi!

I tried using robocopy to copy some files between file servers and it's giving me a syntax error. The command I'm using is:

robocopy \\source_share . /options...

and the error I'm getting is:

"The filename, directory name, or volume label syntax is incorrect."

I used it like this in the past with success. The source and destination are Windows Servers and I'm running robocopy from the destination machine. What could be causing this?

check Best Answer

  • The filename, directory name, or volume label syntax is incorrect 0 file s copied

    OP Wojciech5318

    The filename, directory name, or volume label syntax is incorrect 0 file s copied

    This person is a verified professional.

    Verify your account to enable IT peers to see that you are a professional.

    serrano

    checkBest Answer

    All right! I found the problem: it was in the options for the creation of the log file. Specifically, in how it was supposed to add the current date to the log's name. So what works is this:

    /log+:log_file_%date:~10,4%%date:~4,2%%date:~7,2%.txt

    I run robocopy in a cmd prompt and that option creates a log file in the current directory named like this:

    log_file_YYYYMMDD

    which I was after.

    Was this post helpful? thumb_up thumb_down

  • View Best Answer in replies below

    Read these next...

    • The filename, directory name, or volume label syntax is incorrect 0 file s copied

      Snap! DDoS attack, Safari JWST's JavaScript, space-based solar power, One D&D

      Spiceworks Originals

      Your daily dose of tech news, in brief. We made it to Friday! And while it was actually a Thursday, if we roll back the clock to August 19, 2004, it was definitely a good day for internet search giant Google (now known as Alphabet) as it had its in...

    • The filename, directory name, or volume label syntax is incorrect 0 file s copied

      Cisco switch mystery problem.

      Networking

      I have a Cisco switch that I have to deal with - I have no control over it's configuration and at my facility, there isn't even anyone to ask ( a long story ).  There is a new issue that the ports will close down if another switchis plugged in to it.  The...

    • The filename, directory name, or volume label syntax is incorrect 0 file s copied

      Spark! Pro Series - 8-19-2022

      Water Cooler

      On this day in 1887 Dmitri Mendeleev will ascend in a balloon solo to 3.5 Km above the earth to view an eclipse. The solo part of this adventure came about when it was discovered that the balloon did not have enoug...

    • The filename, directory name, or volume label syntax is incorrect 0 file s copied

      Few days into new job- I feel so out of place

      IT & Tech Careers

      I previously posted here about getting offered a Jr net admin position and how nervous I was. Well I’ve started and am 3 days in and I feel so out of place. When I get to work I’m not even sure what I’m supposed to be doing. So I ask. Told to do something...

    • The filename, directory name, or volume label syntax is incorrect 0 file s copied

      Need clarification on this switch configuration

      Networking

      Hello,We are having a packet loss company wide once in a while, several times in a day for like 30 seconds everyone's network will stop responding. I'm trying to figure out the problem but the network is complicated. I'm currently looking at this switch w...

    1. Home
    2. Windows
    3. The Filename Directory Name Or Volume Label Syntax Is Incorrect Inside Batch

    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied
    The filename, directory name, or volume label syntax is incorrect 0 file s copied

    The filename, directory name, or volume label syntax is incorrect inside batch

    Tags: windows , cmd Answers: 1 | Viewed 185,015 times

    When I am running the following inside batch....


    set PATH='C:\Users\DEB\Downloads\10.1.1.0.4'
    cd !PATH!

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

    Update: There are the solutions that worked for me.



    • Don't use PATH as a var name

    • set it as "myPATH=C:\Users\DEB DAS\Downloads\10.1.1.0.4"



    TessellatingHeckler answer at 2014-07-16 19



    set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4"
    cd %myPATH%


    • The single quotes do not indicate a string, they make it starts: 'C:\ instead of C:\ so


    • %name% is the usual syntax for expanding a variable, the !name! syntax needs to be enabled using the command setlocal ENABLEDELAYEDEXPANSION first, or by running the command prompt with CMD /V:ON.


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



    * The answers/resolutions are collected from stackoverflow, are licensed under CC BY-SA 3.0

    Some Code Answers


    @set PATH=%~dp0\bin;%PATH% @busybox sh -l


    batch file - "The filename, directory name, or volume label …

    6 days ago Jul 11, 2020  · This is a batch script activate.bat from the project w64devkit v1.3.1 @set PATH=%~dp0\bin;%PATH% @busybox sh -l I get error " The filename, directory name, or volume label syntax is incorrect " when i double click the batch script to run it but when i execute the batch script in the ConEmu terminal, it runs fine and drops me into a busybox shell.

    Reviews: 3

    Show details

    See also: Shell File

    Batch File Output Error: The filename, directory name, or …

    4 days ago Jan 21, 2012  · I had a feeling it was encoding problem but wasn't exactly sure how to fix it. Ended up resaving the file in ANSI and that appears to have fixed it.

    Show details

    See also: File

    Error: 0x8007007B The filename, directory name, or …

    1 week ago Jun 28, 2021  · Here’s what you need to do: a)Click the Windows icon in the bottom-left corner and type cmd. Then, right-click on Command Prompt and click on Run as Administrator. b)If you have a password, you will be prompted to insert it at this point. c)In Command Prompt, type slmgr -ipk followed by your product key.

    Show details

    See also: File

    "The filename, directory name, or volume label syntax is …

    6 days ago Mar 29, 2020  · The other day, I went to access these 2 folders and I came to an error/issue. This image is a sample of what some of the folders inside the main folder have been renamed to. I get this message when I try to open one of those folders. This is what it says when I hover over the main folder with my mouse. Mind you, the USB these 2 folders are on ...

    Show details

    See also: Image File

    The filename, directory name, or volume label syntax is incorrect, …

    6 days ago Jul 17, 2021  · The filename, directory name, or volume label syntax is incorrect, c#. i’ve written a console application deploy.exe which runs a batch script. Process p1 = new Process (); p1.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "installer.bat"; p1.StartInfo.WindowStyle = ProcessWindowStyle.Normal; p1.Start (); p1.WaitForExit (); …

    Show details

    See also: C# File

    the filename,directory name, or volume label syntax is …

    5 days ago Aug 22, 2014  · when iam editing batch or ini file by right click edit it shows the error message as "the filename,directory name, or volume label syntax is incorrect" pls provide any solution to solve this issue regards, ram.n

    Show details

    See also: File

    Solved !! The File name, directory name, or volume label …

    1 week ago May 18, 2020  · Solved !! The File name, directory name, or volume label syntax is incorrect || step by step.Hi friends,in this video we teach how to fix this filename or di...

    Show details

    See also: File

    The filename, directory name, or volume label syntax is incorrect, c#

    3 days ago Try printing out what the value of AppDomain.CurrentDomain.BaseDirectory is. It may not be where installer.bat is when you are installing it.. Also, you tried adding the bat file to a custom action (if that is even possible)? And, would it possible to move what is in the bat to the exe?

    Show details

    See also: C# File

    The filename, directory name, or volume label syntax is incorrect ...

    5 days ago set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4" cd %myPATH% The single quotes do not indicate a string, they make it starts: 'C:\ instead of C:\ so %name% is the usual syntax for expanding a variable, the !name! syntax needs to be enabled using the command setlocal ENABLEDELAYEDEXPANSION first, or by running the command prompt with CMD /V:ON. …

    Show details

    See also: String File

    FIX : The filename, directory name or volume label syntax is …

    1 week ago Here's how to fix error The filename, directory name or volume label syntax is incorrect.See you in next video.-----­-----...

    Show details

    See also: File

    The filename, directory name, or volume label syntax is incorrect.

    1 week ago May 07, 2014  · all drives appear as indicated, not adding any, process only finds about 1000 files then errors out with "The filename, directory name, or volume label syntax is incorrect." Nothing suggested above seems to help???

    Show details

    See also: File

    The filename, directory name, or volume label syntax is incorrect

    1 day ago Feb 03, 2017  · Moderator. Replied on February 3, 2017. Hi Vance, Just to be sure that your system is not infected by a malware, run Microsoft Safety Scanner. Run a System File Checker to restore default registry after the malware scan is finished. Let us know the outcome.

    Show details

    See also: Rest File

    The filename, directory name, or volume label syntax is incorrect ...

    1 week ago The filename, directory name, or volume label syntax is incorrect inside batch. The single quotes do not indicate a string, they make it starts: 'C:\ instead of C:\ so. %name% is the usual syntax for expanding a variable, the !name! syntax needs to be enabled using the command setlocal ENABLEDELAYEDEXPANSION first, or by running the command prompt with CMD /V:ON.

    Show details

    See also: String File

    Please leave your answer here: