problem with script files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Briandr
Posts: 3
Joined: 13 Jun 2013 09:43

problem with script files

#1 Post by Briandr » 13 Jun 2013 09:51

Hi,

I have a self extracting EXE that dumps the below script into %temp% as well as a screensaver. The script does not appear to be able to handle copying the screensaver to %windir%\system32.

@ECHO ON
Set RegVar=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegVar% 2>NUL | find /I /N "x86">NUL
If [%ERRORLEVEL%] == [0] (
echo X86
cd %windir%\system32
If exist brian.scr ren brian.scr brianold01.scr
GOTO FILEMOVE1
) ELSE (
echo AMD64
cd %windir%\system32
If exist brian.scr ren brian.scr brianold01.scr
cd %windir%\sysWOW64
If exist brian.scr ren brian.scr brianold01.scr
GOTO FILEMOVE2

)
:FILEMOVE1
MOVE /Y %~dp0\brian.scr %windir%\system32\brian.scr
exit
:FILEMOVE2
COPY /Y %~dp0\brian.scr %windir%\system32\brian.scr
MOVE /Y %~dp0\brian.scr %windir%\sysWOW64\brian.scr
exit

Any ideas as to what could be broken?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: problem with script files

#2 Post by foxidrive » 13 Jun 2013 10:36

It doesn't cater for long pathname elements - and will probably need to be run as Admin to copy files into system32.

Briandr
Posts: 3
Joined: 13 Jun 2013 09:43

Re: problem with script files

#3 Post by Briandr » 13 Jun 2013 10:55

Tried running it as admin (right clicked the EXE created by WinRAR).

This does appear to work on XP x86 systems (file is copied to system32)

This is not working on W7 x64 systems.

Any other ideas?

Post Reply