Calling Batch File People

Page 3 of 3 FirstFirst 123

  1. Posts : 3,502
    Win_8.1-Pro, Win_10.1607-Pro, Mint_17.3
       #21

    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-winmenu-1.png+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:

    cereberus said:
    Well I see the xcopy command syntax looks all wrong for starters. it should look something like

    xcopy C:\sourceFolder E:\targetFolder /D /E /C /R /H /I /K /Y
    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
      My Computer


  2. Posts : 414
    Windows 10 Pro
       #22

    iamjim said:
    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.
    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

    '\\FILES\Storage'
    CMD.EXE was started with the above path as the current directory.
    UNC paths are not supported. Defaulting to Windows directory.
    C:\Windows
    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.
    Last edited by AndreyT; 19 Jul 2016 at 00:05.
      My Computer


  3. Posts : 132
    windows 10
    Thread Starter
       #23

    Slartybart said:
    Command Prompt: should open to your User Profile
    (%UserProfile%)
    Command Prompt (Admin): should open to C:\Windows\system32
    Both do what they're supposed to do.

    Try Winkey Calling Batch File People-winmenu-1.png+X
    Select Command Prompt
    enter the following command
    set

    post a screen shot of the output
    That was a lot of trouble. So, I sure hope it leads somewhere.

    The image is large so I'm linking to it
    Last edited by iamjim; 19 Jul 2016 at 01:15.
      My Computer


  4. Posts : 132
    windows 10
    Thread Starter
       #24

    AndreyT said:
    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.
    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:

    'Other' is not recognized as an internal or external command,
    operable program or batch file.
    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.
      My Computer


  5. Posts : 132
    windows 10
    Thread Starter
       #25

    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???????????
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:53.
Find Us




Windows 10 Forums