+ Reply to Thread
Results 1 to 2 of 2

Windows 7 Forum

Need to Convert Windows XP Batch File to Windows 7

Fix and Repair Windows 7

  1. #1
    Grayson Lee is offline Junior Member Grayson Lee is on a distinguished road
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    7


    Did you find this post helpful? Yes | No

    Need to Convert Windows XP Batch File to Windows 7

    Hello:

    This is my first time posting here. Thanks in advance for any assistance.

    I have a batch file that worked faithfully in Windows XP. I wish to update the code to work in Windows 7 Ultimate (64-bit).

    The code creates a folder with a date in its name. the code is as follows:

    @echo off
    cls
    :: Create environment variables with today's date values.
    setlocal
    for /f "tokens=1-4 delims=/ " %%i in ('date /t') do (
    set Day=%%i
    set MM=%%j
    set DD=%%k
    set YYYY=%%l
    )
    :: Create backup folder with today's date and move disk image to backup folder.
    md D:\Backup\-- F-BU

    In Windows XP, a folder with path D:\Backup\2010-02-09 F-BU would be created.

    However, when I run the code in Windows 7, I get a folder with path and name as follows: D:\Backup\-- F-BU

    If anyone could please help me out, it would be greatly appreciated.

    Thanks,

    Grayson

  2. #2
    sayyedj is offline Junior Member sayyedj is on a distinguished road
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    6


    Did you find this post helpful? Yes | No
    I think your script had something wrong. You can amend the script as below . There are two methods.

    You can use this way ----
    @echo off
    cls
    :: Create environment variables with today's date values.
    setlocal
    for /f "tokens=1-4 delims=/ " %%i in ('date /t') do (
    set DD=%%i
    set MM=%%j
    set YYYY=%%k
    )
    :: Create backup folder with today's date and move disk image to backup folder.
    md D:\Backup\%YYYY%-%MM%-%DD%-F-BU
    --------------------------------------------------------------------------------------------------
    Or

    for /f "tokens=1-4 delims=/ " %%i in ('date /t') do ( md D:\Backup\%%i-%%j-%%k-F-BU )

+ Reply to Thread

Similar Threads

  1. Convert to .dvr-ms format missing in Windows 7
    By freycl in forum Windows 7 Support
    Replies: 1
    Last Post: 12-10-2009, 03:15 PM
  2. How to convert your Windows Server 2003 to a Workstation
    By cybercore in forum Windows Server
    Replies: 0
    Last Post: 11-29-2009, 11:55 AM
  3. Copy to c:\ doesn't work with batch file
    By Glip in forum Windows 7 Programming and Scripting
    Replies: 27
    Last Post: 10-30-2009, 07:02 PM
  4. Replies: 1
    Last Post: 08-24-2009, 10:48 PM
  5. Batch files in Home Premium
    By wildcatxxx in forum Windows Vista Support
    Replies: 0
    Last Post: 12-11-2007, 01:40 PM

Posting Permissions

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