none
W7_64 : Batch Script : commands : xcopy and DIR : log say "success" but the changes are not not done RRS feed

  • General discussion

  • Hello,
    I work on Windows 7 Pro 64 bits

    I buid a script that make 3 things :
    1 + xcopy a file (a other "batch.cmd" file)
    2 + DIR
    3 + write a log for the actions 1 and 2.

    The CMD window where the script is executed and the log say "success" for the 3 actions, and the manual check inside the log show the "batch.cmd" file copied inside the good directory.
    Then, everything seems to be OK.

    The script is executed by the SYSTEM account.

    But the reality is that the destination directory is empty, no "batch.cmd", nothing.

    Why ?
    --
    xcopy c:\src_dir\batch.cmd c:\dest_dir /R /H /Y  >> c:\log_dir\log_file.log
    DIR /S /A /Q c:\dest_dir >> c:\log_dir\log_file.log
    --
    Read the log_file.log :
    --
    1 file copied
    c:\dest_dir\batch.cmd
    --


    • Edited by Cerkyr Wednesday, February 17, 2016 10:13 AM
    Wednesday, February 17, 2016 9:07 AM

All replies

  • I try this :

    --

    xcopy c:\src_dir\batch.cmd C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown /R /H /Y  >> c:\log_dir\log_file.log

    DIR /S /A /Q C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown >> c:\log_dir\log_file.log

    --
    The log file say that the file is copied in the good folder.
    I don't find the script file when I open the Explorer.

    But I find the script file here :
    C:\WINDOWS\syswow64\GroupPolicy\Machine\Scripts\Shutdown

    --

    What happen ?!!!

    --

    Is there any redirection file ?
    Why ?
    Is it normal or an external configuration ?



    • Edited by Cerkyr Wednesday, February 17, 2016 10:13 AM
    Wednesday, February 17, 2016 9:50 AM
  • You are running in 32 bit session.


    \_(ツ)_/

    Wednesday, February 17, 2016 11:44 AM
  • Then to clarify :
    Is it correct ?

    I use a Windows Seven 64 bits, but all my activites are done in a "32 bits sessions"
    Then, each time, I do something manually or inside a script, the executions are done in 32 bits ?

    If i build a Local GPO, with GPEDIT.msc, to run a script at the shutdown, the registry is updated with that :

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0\0

    but, few minutes ago, the changes was done here :

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0

    Then, I don't see any change on the folders, then I plan to bypass this issue...but again, the script is not starting at the shutdown.

    nothing is clear for me.

    Can you explain more ?

    Wednesday, February 17, 2016 5:12 PM
  • You can only access the 64 bit items from a 64 bit session.

    \_(ツ)_/

    Wednesday, February 17, 2016 5:24 PM
  • You can only access the 64 bit items from a 64 bit session.

    \_(ツ)_/

    Or by using the method in the link I posted.


    EDIT: Just to be clear, this is the relevant snip:

    32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.


    Wednesday, February 17, 2016 5:32 PM
  • Then, If I don't wan't to have any problem with 64 bits (redirection), I need to copy my files inside a "sysnative" sub-folder ?

    Is it correct ?


    • Edited by Cerkyr Wednesday, February 17, 2016 5:42 PM
    Wednesday, February 17, 2016 5:41 PM
  • Does not help with the registry.

    \_(ツ)_/

    Wednesday, February 17, 2016 5:41 PM
  • What ?
    Wednesday, February 17, 2016 5:46 PM
  • Then, If I don't wan't to have any problem with 64 bits (redirection), I need to copy my files inside a "sysnative" sub-folder ?

    Is it correct ?

    It's not a real folder.

    Read the link I posted and give it a try for yourself.

    Does not help with the registry.


    \_(ツ)_/

    I guess I've never tried to directly modify the registry using this method. I've only utilized this for ConfigMgr deployments really.


    Wednesday, February 17, 2016 5:51 PM
  • Hello,

    Instead of propose a link, can you explain with an example in détails , ste p by step ?

    Regards,

    Friday, February 19, 2016 10:23 AM