Discussion:
[wpkg-users] Renaming file in System32
J***@materna.de
2016-08-17 08:19:50 UTC
Permalink
Hi

I've been trying to copy images to a folder within System32 and then rename one of them.
I created one package responsible to copy the images to the path and then rename one file.

The copying works. Since I'm using xcopy the missing folders are being generated automatically.
I can see, that the files have been copied correctly and rename them using the explorer.

However any attempt of renaming one file afterwards failed.
Strangely this seems to only happen when using wpkg.
When trying to execute it manually using cmd it works just fine.
Whenever using wpkg I get the "The system cannot find the path specified" error.
I tried to run the package multiple times to ensure that the images are properly copied.
I tried to run the package without the xcopy command to make sure the files are not in use.
Those were not the issue.

Below I will include the code snippets I used without the boilerplate package structure or checks:

<install cmd='xcopy "%RESOURCES%\images\*" "%windir%\System32\oobe\info\backgrounds" /y /i /q /r' />
<install cmd='rename "%windir%\System32\oobe\info\backgrounds\old_filename.jpg" backgroundDefault.jpg ' />

%RESOURCES% links to the folder which includes the images that have to be copied.

Best

Jan-Niklas Nowak
Auszubildener zum
Fachinformatiker
Anwendungsentwicklung

Business Line Mobility
______________________________________________
Telefon: +49 231 5599-8125
E-Mail: ***@materna.de
Materna GmbH | Voßkuhle 37 | D-44141 Dortmund | Germany
Geschäftsführer: Helmut Binder, Ralph Hartwig
Amtsgericht Dortmund HRB 5839
Andreas Schamanek
2016-08-17 08:33:27 UTC
Permalink
Post by J***@materna.de
<install cmd='xcopy "%RESOURCES%\images\*"
"%windir%\System32\oobe\info\backgrounds" /y /i /q /r' />
Since you are copying you are creating new files, likely with
different permissions. Try setting them with e.g. `cacls` or consider
using /o and /x with xcopy.

Cf. https://technet.microsoft.com/de-de/library/cc771254(v=ws.10).aspx
--
-- Andreas

:-)

---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Rainer Meier
2016-08-17 10:20:51 UTC
Permalink
Hi
Another quick shot: Make sure you're running 64-bit cmd.exe for the rename
operation. If you run 32-bit WPKG (32-bit cscript.exe) it will launch 32-bit
cmd.exe and therefore being unable to access %SystemRoot%\system32 (64-bit
folder) but you're redirected to %SystemRoot%\SysWow64 (32-bit folder) where the
files potentially don't exist.

br,
Rainer
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Nicolas Briche
2016-08-17 08:53:43 UTC
Permalink
Hi,
Post by J***@materna.de
%RESOURCES% links to the folder which includes the images that have to be copied.
Two thoughts, besides the rights issues already mentioned:

- Maybe 'rename' should be ran with %COMSPEC% (%COMSPEC% /c rename); I
don't remember if it's a separate exe or built into cmd.

- Also try to specify an absolute path for the new name along with the
old name. We don't really know what the current working directory is
when you invoke rename, so it may try to rename the file somewhere that
either doesn't exist or you don't have rights to it.

N.
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Malte Starostik
2016-08-17 14:34:48 UTC
Permalink
Post by Nicolas Briche
Hi,
Post by J***@materna.de
%RESOURCES% links to the folder which includes the images that have to be copied.
- Maybe 'rename' should be ran with %COMSPEC% (%COMSPEC% /c rename); I
don't remember if it's a separate exe or built into cmd.
rename is a cmd builtin, so %COMSPEC% (or just cmd nowadays) /c is required.
Post by Nicolas Briche
- Also try to specify an absolute path for the new name along with the
old name. We don't really know what the current working directory is
when you invoke rename, so it may try to rename the file somewhere that
either doesn't exist or you don't have rights to it.
Definately not. rename, as opposed to many other file commands will NOT accept
a target name with path. As opposed to move on Windows and mv elsewhere,
rename really just renames and has no way of moving the file to a different
path.

Kind regards,
Malte
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Nicolas Briche
2016-08-18 08:58:55 UTC
Permalink
Post by Malte Starostik
Post by Nicolas Briche
- Also try to specify an absolute path for the new name along with the
old name. We don't really know what the current working directory is
when you invoke rename, so it may try to rename the file somewhere that
either doesn't exist or you don't have rights to it.
Definately not. rename, as opposed to many other file commands will NOT accept
a target name with path. As opposed to move on Windows and mv
elsewhere,
rename really just renames and has no way of moving the file to a different
path.
Ah, I didn't know that. Thanks for the info.

N.
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Marco Schmidt
2016-08-18 05:22:28 UTC
Permalink
Besides the copy and rename problem, you might want to take a look on this:

https://technet.microsoft.com/en-us/sysinternals/bginfo

Greetings ...
Marco
Hi
I’ve been trying to copy images to a folder within System32 and then
rename one of them.
I created one package responsible to copy the images to the path and then rename one file.
The copying works. Since I’m using xcopy the missing folders are being
generated automatically.
I can see, that the files have been copied correctly and rename them using the explorer.
However any attempt of renaming one file afterwards failed.
Strangely this seems to only happen when using wpkg.
When trying to execute it manually using cmd it works just fine.
Whenever using wpkg I get the “The system cannot find the path
specified” error.
I tried to run the package multiple times to ensure that the images are properly copied.
I tried to run the package without the xcopy command to make sure the files are not in use.
Those were not the issue.
Below I will include the code snippets I used without the boilerplate
<install cmd='xcopy "%RESOURCES%\images\*"
"%windir%\System32\oobe\info\backgrounds" /y /i /q /r' />
<install cmd='rename
"%windir%\System32\oobe\info\backgrounds\old_filename.jpg"
backgroundDefault.jpg ' />
%RESOURCES% links to the folder which includes the images that have to be copied.
Best
*Jan-Niklas Nowak**
*Auszubildener zum
Fachinformatiker
Anwendungsentwicklung
Business Line Mobility
______________________________________________
Telefon: +49 231 5599-8125
Materna GmbH | Voßkuhle 37 | D-44141 Dortmund | Germany
Geschäftsführer: Helmut Binder, Ralph Hartwig
Amtsgericht Dortmund HRB 5839
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
https://lists.wpkg.org/mailman/listinfo/wpkg-users
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Loading...