Windows 10: Batch file does not recognize spaces, unable to get it to follow UNC path with spaces.

Discus and support Batch file does not recognize spaces, unable to get it to follow UNC path with spaces. in Windows 10 Customization to solve the problem; Hello, I am trying to create a batch file which will pull an .exe from a UNC file path that has spaces in it but I can't figure out how to use the... Discussion in 'Windows 10 Customization' started by KyleParliament, Mar 10, 2020.

  1. Batch file does not recognize spaces, unable to get it to follow UNC path with spaces.


    Hello,


    I am trying to create a batch file which will pull an .exe from a UNC file path that has spaces in it but I can't figure out how to use the quotations to make it work.


    So far I've tried the following:


    @echo off

    start "\\servername\sharepath\share path\setup.exe"



    @echo off

    start ""\\servername\sharepath\share path\setup.exe""



    @echo off

    start "" \\servername\sharepath\share path\setup.exe



    @echo off

    start "" \\servername\sharepath\share path\setup.exe ""


    The batch file just tells me it can't find that UNC path. I've looked at countless stack overflow articles to no avail. Any assistance is appreciated.

    :)
     
    KyleParliament, Mar 10, 2020
    #1

  2. How to move and link files

    1. Place your batch file (or a shortcut to it) on your desktop, then drop the file to be moved and linked onto the shortcut. Its name & path will appear as the first batch file argument (%1).
    2. Use UNC paths when creating your symbolic links with mklink.
     
    Frederik Long, Mar 10, 2020
    #2
  3. fahnix Win User
    Batch files fail pathing and [%04d]

    1 When running in Administrator mode batch files automatically take on the Windows\System32 folder unless a prefix is added to the top of the file.

    command example: copy file1.txt "C:\Users\Public\Test\."

    result copies file in current folder to "C:\Users\Public\Test\file1.txt"

    result from batch file as admin is an error stating "File not found" because Admin mode attempts to call commands listed in file from [Windows\System32] folder.

    include [cd %~dp0] at top of batch file to ensure commands run from the folder the batch file resides in.

    2 When running ffmpeg.exe in one folder and writing files to another folder from a batch file Windows automatically pastes the entire path and the batch file name prior to every attempted file write.

    ffmpeg command example :

    bin\ffmpeg.exe -i "C:\Users\JoeMatize\Videos\Logitech Webcam\video 3.wmv" -r 15 "frames-%04d.bmp"

    then windows creates 15 frames per second naming files [frames-0001.bmp] through [frames-0015.bmp] for the 1st second and continuing through the entire file

    But ffmCmd.bat file contains the command attempts to create the output file as...

    "C:\_dev\_Video\FFMPeg_Zeranoe\ffmpeg-20160517-git-af3e944-win64-static\ffmCmd.bat4d.bmp"

    ffmpeg fails when it is unable to acquire a new name for the sequential files.

    is there another command that will fix the batch call to ffmpeg, like the one that fixes the administrative mode path?

    When will Microsoft fix the batch files so they work consistently across the board?
     
    fahnix, Mar 10, 2020
    #3
  4. AndreyT Win User

    Batch file does not recognize spaces, unable to get it to follow UNC path with spaces.

    Calling Batch File People


    I just created a simple batch file that displays the current dir ('echo %cd%' command). Placed that file on a non-mapped network share ('\\FILES\Storage' in my case) and run it from there. I got this

    The first part is a warning that CMD.EXE gave me when I started the batch file. The last bit - C:\Windows - is the output of 'echo %cd%' command.

    I.e. when the current dir is specified by an UNC path, then the batch shell simply defaults to C:\Windows as the current dir. Apparently this is exactly what happens in your case.

    There could be something else at work here (which is hard to figure out without knowing more about your setup), but the fact that you see "network" address as the path means that the current location will be specified by an UNC path. The rest follows.
     
    AndreyT, Mar 10, 2020
    #4
Thema:

Batch file does not recognize spaces, unable to get it to follow UNC path with spaces.

Loading...
  1. Batch file does not recognize spaces, unable to get it to follow UNC path with spaces. - Similar Threads - Batch file does

  2. Unable to open UNC path from the Outlook App

    in Windows 10 Gaming
    Unable to open UNC path from the Outlook App: I am unable to open UNC path from outlook app - Have tried reparing and reinstalling- Have tried adding on the trusted site- I do have permission to the shared network path UNC resouce- Connected to the file server is OK as well- Seems to be outlook issue any fixes ?- outlook...
  3. Unable to open UNC path from the Outlook App

    in Windows 10 Software and Apps
    Unable to open UNC path from the Outlook App: I am unable to open UNC path from outlook app - Have tried reparing and reinstalling- Have tried adding on the trusted site- I do have permission to the shared network path UNC resouce- Connected to the file server is OK as well- Seems to be outlook issue any fixes ?- outlook...
  4. Unable to open UNC path from the Outlook App

    in Windows 10 BSOD Crashes and Debugging
    Unable to open UNC path from the Outlook App: I am unable to open UNC path from outlook app - Have tried reparing and reinstalling- Have tried adding on the trusted site- I do have permission to the shared network path UNC resouce- Connected to the file server is OK as well- Seems to be outlook issue any fixes ?- outlook...
  5. UNC path can not be accesss

    in Windows 10 Network and Sharing
    UNC path can not be accesss: How to access it?Unc path can not be accessed its showing network path can not be found https://answers.microsoft.com/en-us/windows/forum/all/unc-path-can-not-be-accesss/9fc7277a-c1ec-4206-ae9c-4d37871cb3d7
  6. How to get my own path in a batch-file.

    in Windows 10 Network and Sharing
    How to get my own path in a batch-file.: Default answer is %~dp0. And most times this will work fine. But there is a bug in cmd.exe which will prevent this from working correctly under certain circumstances if you use double quotes to call the batch. Double quotes are necessary if the name or path of the batch file...
  7. Mapped drives and unc path

    in Windows 10 Network and Sharing
    Mapped drives and unc path: I am runing Windows 10 version 20H2 with all updates applied on a peer to peer network with drives mapped to a shared network location on a Win Server 2012 R2. I also accesed other files from the server using the UNC path to the files. Suddenly both the mapped drives would...
  8. Trouble with batch files and paths

    in Windows 10 Support
    Trouble with batch files and paths: Running win 10 v 1909 build 18363.720. I am pretty green with batch files and paths. I am trying to automate and editing process with mkvpropedit on a bunch of MKV files. I put the bat file in the same folder as the mkvs. Batch file contains: @echo off for %%a in (*.mkv)...
  9. Task Scheduler path with spaces

    in Windows 10 Software and Apps
    Task Scheduler path with spaces: Hi, I need to execute some files in the Task Scheduler that have spaces in the path of the "Start a program". I've read some solutions online about using some code and \" or whatever, but I don't think that applies to me, as I'm using the App and I don't even have arguments....
  10. String with spaces in set /p (batch file)

    in Windows 10 Software and Apps
    String with spaces in set /p (batch file): Hi! I would like to let a user type in things with spaces in set /p. This is the code I currently have that does not work: Code: :newdoc2 cls echo What do you want to say? set saynew=%randomnum% set /p saynew= if %saynew% == %randomnum% goto newdoc2 echo "%saynew%"...

Users found this page by searching for:

  1. batch file path with spaces not working