problem with Xcopy variables, or something

Convert your BATch files into EXEcutable format in one click.
Post Reply
notused
Posts: 4
Joined: Mon Nov 22, 2010 8:40 pm

problem with Xcopy variables, or something

Post by notused » Tue Nov 23, 2010 6:56 am

Hi everyone,

I have a problem with a batch file. No that statement is wrong, my .bat works fine but when I convert it to a exe I get errors.
My code is underneath.
You can skip the first lines untill you get to the echo of 2 paths. All the rest above it is simply the searching of both paths and checking if they're correct. Then I made a switch, to copy from path A to B or B to A and a delete statement to delete A. The delete works fin,
but when I use the first xcopy in a exe I get this:
file not found - cmdlnMYDOCPATH.
when I use the second xcopy in a exe I get this:
file not found - cmdlnCURRENT.
I know there's a similarity between these two errors, the path of the destination ofcourse but I don't see what the file is doing wrong or how to fix it.

EDIT: using version 3.2.4.0, although the splash screen says 3.2.8.0 .....
:o
Can you guys and gals help me out?

Thx in advance!


Code: Select all

@ECHO off 
for /f "tokens=1-2*" %%A in (' REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ') do if "%%A"=="AppData" set MYDOCPATH=%%C
echo This user's document roaming is: %MYDOCPATH%
set CURRENT=%~dp0
set CURRENT=%CURRENT%SAVE\
c:
cd %MYDOCPATH%
cd..
set MYDOCPATH=%CD%
set MYDOCPATH=%MYDOCPATH%\Local\Criterion Games\Burnout Paradise\
echo %MYDOCPATH%
echo %MYDOCPATH%
echo %CURRENT%

:start
ECHO.
ECHO 1. Save to Hard Disk
ECHO 2. Save to Removable Drive
ECHO 3. Remove from Hard Disk 
set choice=
set /p choice=Type the number select your choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto hello
if '%choice%'=='2' goto bye
if '%choice%'=='3' goto deleting
ECHO "%choice%" is not valid please try again
goto start
:hello
XCOPY "%CURRENT%*.*" "%MYDOCPATH%" /Y /C /I /E /D /S
goto end
:bye
XCOPY "%MYDOCPATH%*.*" "%CURRENT%" /Y /C /I /E /D /S
goto end
:deleting
rmdir /s /q "%MYDOCPATH%"
goto end
:end

support
Site Admin
Posts: 404
Joined: Fri Feb 13, 2004 1:05 pm

Post by support » Fri Nov 26, 2010 3:42 am

This bug has been confirmed, program considered that

"%CURRENT%*.*"

use the %* statement inside.

As workaround you can replace it with

"%CURRENT%\*.*"

notused
Posts: 4
Joined: Mon Nov 22, 2010 8:40 pm

Post by notused » Sat Nov 27, 2010 8:05 pm

ok thx, i'll try :)

notused
Posts: 4
Joined: Mon Nov 22, 2010 8:40 pm

Post by notused » Mon Nov 29, 2010 4:59 pm

This my code becomes something like this.
well when I run the exe, it gives me the same error or it can't find the files, any other suggestions ,?
I guess the problem is that my path variables (CURRENT and MYDOCPATH) end with a \ I'm not sure though....


Code: Select all

@ECHO off 
for /f "tokens=1-2*" %%A in (' REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ') do if "%%A"=="AppData" set MYDOCPATH=%%C
echo This user's document roaming is: %MYDOCPATH%
set CURRENT=%~dp0
set CURRENT=%CURRENT%SAVE\
c:
cd %MYDOCPATH%
cd..
set MYDOCPATH=%CD%
set MYDOCPATH=%MYDOCPATH%\Local\Criterion Games\Burnout Paradise\
echo %MYDOCPATH%
echo %MYDOCPATH%
echo %CURRENT%

:start
ECHO.
ECHO 1. Save to Hard Disk
ECHO 2. Save to Removable Drive
ECHO 3. Remove from Hard Disk 
set choice=
set /p choice=Type the number select your choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto hello
if '%choice%'=='2' goto bye
if '%choice%'=='3' goto deleting
ECHO "%choice%" is not valid please try again
goto start
:hello
XCOPY "%CURRENT%\*.*" "%MYDOCPATH%" /Y /C /I /E /D /S
goto end
:bye
XCOPY "%MYDOCPATH%\*.*" "%CURRENT%" /Y /C /I /E /D /S
goto end
:deleting
rmdir /s /q "%MYDOCPATH%"
goto end
:end

support
Site Admin
Posts: 404
Joined: Fri Feb 13, 2004 1:05 pm

Post by support » Mon Nov 29, 2010 8:24 pm

We will release update soon.

Post Reply