Windows 10: Calling Batch File People

Discus and support Calling Batch File People in Windows 10 Support to solve the problem; It's spread across two lines I believe. It's the rest of the xcopy statement. C:\Windows>xCopy J:\DCIM\198___07\*.* /D /C... Discussion in 'Windows 10 Support' started by iamjim, Jul 18, 2016.

  1. AndreyT Win User

    Calling Batch File People


    The first line is the batch file command.

    The second line is the feedback produced by that command - the name of the file xcopy attempts to copy.

    Nothing is split here.
     
    AndreyT, Jul 18, 2016
    #16
  2. AndreyT Win User
    AndreyT, Jul 18, 2016
    #17
  3. AndreyT Win User
    And in which folder is this batch file located?

    Judguing by the error message, this batch file is stored in C:\Windows folder. If so, then I don't understand how you expect this to work. If simply double-clicked in FIle Explorer, this batch file will nonchalantly attempt to copy your photos to C:\Windows. The latter is protected from unauthorized modification. In fact, it should not work in Windows 8 or Windows 7 either, for exactly the same reason.

    (And I find it strange that someone would want to copy their photos straight to C:\Windows.)
     
    AndreyT, Jul 18, 2016
    #18
  4. iamjim Win User

    Calling Batch File People

    Perhaps I wasn't clear earlier. The folder the batch file is in is an ordinary folder in a completely different internal drive from the C: drive Windows is in. Yes, the reason it's failing is because, for some bizarre reason, the batch file must think it's in the Windows directory and it's trying to copy to that directory which is forbidden.

    This is the same batch file in the same folder, trying to copy from the same location that is in a drive completely unaffected by the upgrade that has been working perfectly for years before I upgraded to Windows 10
     
    iamjim, Jul 18, 2016
    #19
  5. AndreyT Win User
    OK, that's indeed strange.

    What happens if you do the same thing from Command Prompt (instead of File Explorer)? I.e. if you start Command Prompt, cd to your batch file's location on that other drive and run it manually from the prompt?
     
    AndreyT, Jul 18, 2016
    #20
  6. iamjim Win User
    I'll do that if you want, but to get this file working I added a change to the drive and folder it's in at the beginning of the batch file. When I do that it works.
     
    iamjim, Jul 18, 2016
    #21
  7. iamjim Win User
    Here's another of several oddities that came with 10. The address (path?) bar at the top gives a network address rather than a local address. I don't know how to fix that or several others either.
     
    iamjim, Jul 18, 2016
    #22
  8. Calling Batch File People

    Command Prompt: should open to your User Profile
    (%UserProfile%)

    Command Prompt (Admin): should open to C:\Windows\system32

    Your Command screen shot indicates by the prompt that your command opens to C:\Windows
    That is not normal.

    How are you launching Command Prompt?
    There are a number of different ways (Run dialog, Quick Access Toolbar ... aka X-menu, from search results, from File Explorer blue FILE menu).

    Try Winkey
    Calling Batch File People [​IMG]
    +X
    Select Command Prompt
    enter the following command

    set
    post a screen shot of the output
    then you can exit Command

    The easiest thing to do is what cerebus suggested, fully qualify the source and destination:

    You could also pass the targetFolder as a parameter

    batFileCopy.bat E:\targetFolder
    You have to change the batch file to use the passed parameter

    xcopy C:\sourceFolder %1 /D /E /C /R /H /I /K /Y

    You would need to test that a parameter was passed
    noParm decision > prompt for targetFolder
    noParm decision > use a predefined default
    You also might want to test that the targetFolder exists
    noExist decision > offer to create it
    noExist decision > error msg and exit
     
    Slartybart, Jul 18, 2016
    #23
  9. AndreyT Win User
    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, Jul 18, 2016
    #24
  10. iamjim Win User
    Both do what they're supposed to do.

    That was a lot of trouble. So, I sure hope it leads somewhere.

    The image is large so I'm linking to it
     
    iamjim, Jul 18, 2016
    #25
  11. iamjim Win User
    Interesting! You may have hit upon a solution to my problem. When I ran your bat file entering the target directory by way of the drive letter I got this:

    When I ran your bat file entering the target directory using my regular desktop shortcut I got what you got.

    I've now created a new shortcut using the route that worked. I haven't tested it yet but will shortly.
     
    iamjim, Jul 18, 2016
    #26
  12. iamjim Win User
    This is so bizarre. The new shortcut no longer leads to a network path and the cardreader fetch bat file works. *BUT*, now the original shortcut still leads to a network path. In this network folder your bat file still fails and defaults to windows even though the cardreader fetch bat file now works in that folder too???????????
     
    iamjim, Apr 4, 2018
    #27
Thema:

Calling Batch File People

Loading...
  1. Calling Batch File People - Similar Threads - Calling Batch File

  2. Batch File

    in Windows 10 Gaming
    Batch File: Hi, I am trying to create a batch file to determine whether a user account is signed on.I don't have enough experience to get it to @Echo it worked. Any advice please.Batch file:REM Query whether user SBackup is active@echo onsetlocal enabledelayedexpansionset...
  3. Batch File

    in Windows 10 Software and Apps
    Batch File: Hi, I am trying to create a batch file to determine whether a user account is signed on.I don't have enough experience to get it to @Echo it worked. Any advice please.Batch file:REM Query whether user SBackup is active@echo onsetlocal enabledelayedexpansionset...
  4. Batch Files

    in Windows 10 Gaming
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  5. Batch Files

    in Windows 10 Software and Apps
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  6. Batch Files

    in Windows 10 Network and Sharing
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  7. Create batch files with Batch?

    in Windows 10 Software and Apps
    Create batch files with Batch?: How to create Batch and VBS files with Batch? So I write a batch file which I then convert to exe that creates new folders in a certain directory and then creates batch and VBS files with a certain content and saves them in the created folder. So it's similar to a program...
  8. Batch Files

    in Windows 10 Network and Sharing
    Batch Files: I want to make a batch file that will copy a specific folder from my USB stick to a folder on C:\ I want to know if it's possible to make a batch file that will take the folder from my USB drive no matter what the drive's letter is....
  9. Batch File

    in Windows 10 Support
    Batch File: I need a batch file to create a folder with sub folders. The sub folders will be named the current date, they will go in a folder on c drive. For example we can call the folder test and it would be in documents on c drive. Every time we run the batch file it would create a...
  10. batch file

    in Windows 10 Network and Sharing
    batch file: I want a BAT file to be executed when a USB plugged in to the PC. How can I do it? https://answers.microsoft.com/en-us/windows/forum/all/batch-file/1af5ec02-b6c8-4916-959b-ed0327a964e7"