Batch File Question RRS feed

  • Question

  • Is this the correct forum to post a batch file question regarding the "Move" command?



    Thursday, January 12, 2017 6:20 PM


All replies

  • Go ahead.

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Thursday, January 12, 2017 6:23 PM
  • Copying the files works just fine.
    However the error message on the Move command is:  
    "The Filename, directory name or volume label syntax is incorrect."

    Here is my code:
    <begin code>

    @Echo off
    set PuttyFiles1=%USERPROFILE%\Desktop\Original Desktop\PuttyLog*.*
    set Dir2=R:\RLN-NetShare\Oracle-RLN\PuttyLogs\*.*
    Set BatchFile1=MovePuttyLogs.Bat (Jan 2017) 

    : ======================
    Echo Copying files.....

    xCopy "%PuttyFiles1%" "%Dir2%" /Q /Y
    : ======================

    : ======================
    Echo Moving files....

    MOVE /Y "%PuttyFiles1%" "%Dir2%"

    Echo Files moved successfully
    Echo %BatchFile1% completed.
    : ======================

    <end code>


    Thursday, January 12, 2017 8:59 PM
  • Set Dir2=R:\RLN-NetShare\Oracle-RLN\PuttyLogs

    Don't use wildcards


    Thursday, January 12, 2017 9:02 PM
  • Sample list of file in the folder:


    there are many files in the folder with varying dates and timestamps that need to be moved

    I dropped the wildcards and the move does not work.   How can it pick up all files in the folder if I do not use wildcards?


    Tuesday, January 17, 2017 3:21 PM
  • Use "FOR"

    FOR /?

    It has examples.

    You should not be using batch files in the 21st century.  Use PowerShell.

    Move-Item -Path c:\puttylogs\* -Destinatio  R:\RLN-NetShare\Oracle-RLN\PuttyLogs


    Tuesday, January 17, 2017 3:32 PM
  • I would use Powershell but my workstation doesn't have administrative rights to run it.

    • Edited by RLN_SQL Tuesday, January 17, 2017 6:59 PM
    Tuesday, January 17, 2017 6:58 PM
  • What gave you the impression that you need administrative rights to run PowerShell? I can assure you that's not the case.

    -- Bill Stewart [Bill_Stewart]

    Tuesday, January 17, 2017 7:25 PM
  • Run from the PowerShell command line:
    File C:\rlndata\MovePuttyLogs.ps1 cannot be loaded because the execution of scripts is disabled on this system.

    Run from the Powershell IDE:   (same message)
    File C:\RLNDATA\MovePuttyLogs.ps1 cannot be loaded because the execution of scripts is disabled on this system.


    Wednesday, January 18, 2017 8:31 PM
  • Set-ExecutionPolicy RemoteSigned


    Wednesday, January 18, 2017 8:33 PM
  • Right, so you can run PowerShell. You are getting an error about the execution policy. Start here:

    PS C:\> help about_Execution_Policies

    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 18, 2017 8:42 PM
  • (new to PowerShell....)

    Thank you for responses.

    Wednesday, January 18, 2017 8:53 PM