CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    May 2007
    Posts
    134

    copy files(How to write batch file)

    Hi,

    I am using the xcopy comand copy the files,but my question is

    1) i using below command,

    xcopy c:\Sachin \*exe D:\Gilchrist\ /u /y

    this command copy the all files which are already exists , but copy all files its took longer time

    My question is i don't want copy the files which same modified date already exists in destination?

    ------------------------------------------------------------------------------------------------
    Note:

    xcopy c:\Sachin\*.exe D:\Gilchrist\ /d /y

    this command copy the latest modified files
    ------------------------------------------------------------------------------------------------

    Please suggest me How to write a batch file which copy the files those are different modified date?

    Thanks,
    Anand

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: copy files(How to write batch file)

    /D copies the newest files. What do you want? That sounded like it.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    Hi dglienna,


    My question is


    xcopy c:\Sachin\*.exe D:\Gilchrist\ /d /y

    This command copy the latest files, but my question is

    * In d:\ drive have the latest files but in source (c:\) have older files but this time i want copy the olderversion files. and also some time in source & destination have same modified date that time i won't copy those files
    ?


    Please suggest me how can i write batch file?


    Thanks,
    Anand

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: copy files(How to write batch file)

    Basically you are looking to sync the D:\ folder with the C:\ folder, but don't want to overwrite all the files because it takes longer.

    No batch file can do this, but you can get dos software which does.

    http://www.google.com/search?hl=en&q...os&btnG=Search
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    Hi,


    I have the one exe file in "c:\Forms10G\forms90\internet.exe", this file i want to

    move GroupPloicy folder i.e

    1)startup scripts
    2)Shutdown scripts

    Please tell me How can i write batch file which can move this file to group policy script folders?


    Thanks,
    Anand

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: copy files(How to write batch file)

    It's just a simply xcopy command.

    Code:
    xcopy c:\Forms10G\forms90\internet.exe c:\path\to\startupscriptsfolder
    xcopy c:\Forms10G\forms90\internet.exe c:\path\to\shutdownscriptsfolder
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    HI,

    I am facing main problem is path, we can't find "c:\to\startupfolder" we are doing following steps manually,

    1)run "gpedit.msc" command
    2)click on windows settings
    3)click startup and shutdown folder
    3)browse the file and put into above folders(startup & shutdown).

    so i want to this automatically (using batch file) ?

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: copy files(How to write batch file)

    On my Pro box:

    Code:
    c:\windows\system32\GroupPolicy\Machine\Scripts\Startup
    
    
    c:\windows\system32\GroupPolicy\Machine\Scripts\Shutdown
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    HI,

    I tried this path before itself(c:\WINDOWS\system32\GroupPolicy\Machine\Scripts) , But during startup and shutdown time my batch file is not running,

    If i will go set these manually
    1)Run gpedit.msc command
    2)click on wnidows settings
    3)Browse files into scrpits(startup and shutdown )


    in these above steps its working fine.


    Please tell me How can automate these steps?

    OR

    Is there any settings the path "c:\WINDOWS\system32\GroupPolicy\Machine\Scripts" so, the batch file should run?


    Thanks,
    Anand
    Last edited by anandtugaon; October 22nd, 2007 at 01:04 AM.

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: copy files(How to write batch file)

    You need the last folder name, and need to do it for both startup and shutdown
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    HI,


    I called the my batch file in below Path,

    "C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown\Upload.bat"


    So my Upload.bat file is not running during shutdown time?


    Is this path is correct?


    If this not correct please tell me which path i should call ?


    Thanks your time,


    Regards,
    Anand

  12. #12
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: copy files(How to write batch file)

    Don't you have to reboot after changing Group Policy settings? I seem to remember that from somewhere.

    Also, being on a domain will make a difference.


    What's in the upload.bat?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #13
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    Hi,


    My upload.bat ia m runing oracle scripts,

    it contains

    "sqlplus QUOTE/QUOTE@quote.cisgi.com @ c:\forms10g\forms90\Pro_Spin_upload.sql"



    I am running "Pro_Spin_upload.sql" oracle script.


    You told, Do not do my system reboot?

    But i want to do call that batch (Upload.bat) file during shutdown time?



    Please tell me How can I proced?

    Thanks,
    Anand

  14. #14
    Join Date
    May 2002
    Posts
    10,943

    Re: copy files(How to write batch file)

    Quote Originally Posted by anandtugaon
    You told, Do not do my system reboot?
    No, he said that you have to reboot for system changes to take place. However, with Windows XP, a simple logoff and logon will accomplish the same settings refresh.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  15. #15
    Join Date
    May 2007
    Posts
    134

    Re: copy files(How to write batch file)

    Hi,

    I rebooted the my system but it is not working.


    Till i did not get, Why the batch file not working "c:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown" in this path?

    I do not want to go "gpedit.msc" method,

    Is there any alternative method?

    Thanks,
    Anand

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured