Jump to content

Problems with WPI and some Filenames


Recommended Posts

Hi,

I have some problems with files that will not be moved or deletet. :wacko: Files positions are correct.

%AllUsersProfile%\Startmenü\Programme\Acronis\Acronis True Image Home" is a folder.

{MAKEDIR} "%AllUsersProfile%\Startmenü\Programme\Brenn und Festplatten Tools"

{FILEMOVE} "%AllUsersProfile%\Startmenü\Programme\Acronis\Acronis True Image Home" "%AllUsersProfile%\Startmenü\Programme\Brenn und Festplatten Tools\"

will not moved into "Brenn und Festplatten Tools" folder. Foldername is correct!

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

{DELETE} "%AllUsersProfile%\Desktop\Acronis Disk Director.lnk"

will not be deletet, although there. Filename is correct!

The problem seems with long filenames and spaces between the words.

Regards

Jackson

Edited by Jackson0
Link to comment
Share on other sites


  • 2 weeks later...

I think this is more a problem of copy and move.

To move startmenu entries I wrote a script which copies source to target and removes source.

Are you sure that the Link on the Desktop is really a lnk-file? Sometimes the shortcuts are registry-keys (like recycle bin or network)

You can try my script to move you startmenu-entries.

You need sleep.exe (or remove the line with this command).

You can call the script with move.cmd "Acronis" "Brenn und Festplatten Tools"

It searches in %USERPROFILE% AND %ALLUSERPROFILE% and creates the target-dir if necessary.

Al

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
IF EXIST "%SYSTEMDRIVE%\SetWPIEnv.cmd" CALL "%SYSTEMDRIVE%\SetWPIEnv.cmd"

SET SOURCE="%~1"
SET TARGET="%~2"
IF "%~3"=="" (
SET /A LOOPS=0
) ELSE (
SET /A LOOPS=%~3
)
IF NOT "%OVERWRITELOOPS%"=="" SET /A LOOPS=%OVERWRITELOOPS%

IF %SOURCE%=="" GOTO :HELP
IF %TARGET%=="" SET TARGET=!CD!

IF /I "%UNDOMOVE%"=="true" (
ECHO Tausche Quelle und Ziel um die Verschiebung rueckgaengig zu machen.
SET CHANGE=%SOURCE%
SET SOURCE=%TARGET%
SET TARGET=%CHANGE%
SET CHANGE=
)

IF %SOURCE%==%SOURCE:\=% (
CALL :WAIT "%ALLUSERSPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%" "%USERPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%"

IF %TARGET%==%TARGET:\=% (
CALL :MOVE "%ALLUSERSPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%" "%ALLUSERSPROFILE%\STARTM~1\Programme\%TARGET:~1,-1%"
) ELSE (
CALL :MOVE "%ALLUSERSPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%" "%TARGET:~1,-1%"
)

IF %TARGET%==%TARGET:\=% (
CALL :MOVE "%USERPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%" "%USERPROFILE%\STARTM~1\Programme\%TARGET:~1,-1%"
) ELSE (
CALL :MOVE "%USERPROFILE%\STARTM~1\Programme\%SOURCE:~1,-1%" "%TARGET:~1,-1%"
)
) ELSE (
CALL :WAIT %SOURCE%
CALL :MOVE %SOURCE% %TARGET%
)

GOTO :END

:WAIT
SET FOUND=false
:LOOP
FOR %%X IN (%*) DO (
IF EXIST "%%~X" SET FOUND=true
)
IF /I "%FOUND%"=="true" GOTO :NEXT
IF %LOOPS% LEQ 0 GOTO :NEXT
ECHO Warte bis Quelle existiert ^(%LOOPS%^)...
"%~dp0sleep.exe" 1
SET /A LOOPS-=1
GOTO :LOOP
:NEXT
IF %LOOPS% LEQ 0 (
CALL :ERRORMSG "Quelle existiert nicht."
GOTO :END
)
GOTO :EOF

:MOVE
SET SRC="%~1"
SET DEST="%~2"
IF NOT EXIST %SRC% GOTO :END

DIR /A:D %SRC% >NUL 2>NUL
IF %ERRORLEVEL%==1 (
SET ISFILE=TRUE
) ELSE (
SET ISFILE=FALSE
)

SET PARAMS=/V /I /F /G /H /R /Y

IF NOT EXIST %DEST% MD %DEST%
IF /I %ISFILE%==FALSE (
IF "%SRC:~-2,1%"=="\" SET SOURCE="%SRC:~1,-2%"
IF "%DEST:~-2,1%"=="\" SET TARGET="%DEST:~1,-2%"
FOR %%T IN (%SRC%) DO SET DEST="%DEST:~1,-1%\%%~nxT"
SET PARAMS=%PARAMS% /E
)
IF NOT EXIST %DEST% MD %DEST%

XCOPY %PARAMS% %SRC% %DEST%

IF NOT %ERRORLEVEL%==0 (
CALL :ERRORMSG "Es ist ein Fehler (ERRORLEVEL: %ERRORLEVEL%) aufgetreten."
GOTO :END
)

IF %ISFILE%==TRUE (
DEL /F /Q %SRC%
) ELSE (
RD /S /Q %SRC%
)

GOTO :END

:HELP
ECHO.Anwendung: %~nx0 source [target]
ECHO.
GOTO :END

:ERRORMSG
ECHO FEHLER: %~1
GOTO :EOF

:END
ENDLOCAL

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...