Jump to content

Copying files over


mazin

Recommended Posts

Sometimes we execute a command for copying files and find that nothing was copied.

Also, we may have messages like these in case we use the PAUSE command:

- The syntax of the command is incorrect

- Access is denied.

0 file(s) copied.

- Bad command or file name

In case we don't use the PAUSE command, we won't get messages and won't get files copied over.

Even if we use the "copy /y", copying might fail.

Mostly, files we wanted to replace were system files, read-only files, or protected ".exe" files.

Or, we might type paths or file names mistakenly.

Whatever the cause is, I use WinRAR to make a silent SFX that forces files to be copied, either files replace others or don't.

Example 1

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

Packing for extraction

Suppose we want to copy a folder named "incoming" that contains files or folders or both. These are the steps:

1- Right-click the folder "incoming", wherever it is.

2- From the WinRAR shortcut menu, click Add to "incoming.rar".

3- Right-click the resulting archive "incoming.rar", and choose "Open". It should open in WinRAR.

4- Hit Alt+x on your keyboard. The SFX tab appears. Press the button "Advanced SFX options".

5- Under the "General" tab, in the field "the Path to extract", type this:

%systemdrive%\Program Files\Common Files\Symantec Shared\VirusDefs\

Don't add any quotation marks.

Here, we assume that the folder "incoming" needs to be pasted inside the folder "VirusDefs". So, the back slash "\" is a must!

6- Still under the "General" tab, choose "Create in the current folder".

So that the resulting SFX "incoming.exe" is put inside the folder where you work now.

7- Under the "Modes" tab, choose "Hide all" as a silent mode, "Overwrite all files" as an overwrite mode. Press "OK" for the "Advanced SFX options" dialogue box to close.

8- Press "OK" for the other dialogue box to close. Close WinRAR.

Now, you should have a self-extracting archive of name "incoming.exe" with a familiar icon of a box with three books!

9- Delete the folder "incoming" and the archive "incoming.rar" as they are no longer needed.

Now, if you run "incoming.exe", either directly or from a batch, it should execute silently without any switches, even if it replaces another folder of the same name and with the same contents.

Other persons may have different methods. If so, please contribute.

Link to comment
Share on other sites

  • 2 months later...

Example 2

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

Packing for installation

I assume you want to pack the two files needed for installing Adobe Reader 6.0, which are cab + msi.

1- Open WinRAR. Go to: File --> Browse for folder. Browse to the folder in which you stored the two files.

2- Highlight the two files. Go to: Commands --> Add files to archive, The "Archive name and parameters" dialog box appears.

On the "General" tab, press the button "Profiles..." and choose "Default Profile".

Still On the "General" tab, in the field "Archive name", type a name for the new compressed file like AR6.exe, and don't forget the extension ".exe"

Then, choose these parameters:

- Archive format: RAR

- Compression method: Best

- Archiving options: Create SFX archive

You don't need to play with other parameters.

3- Go to "Advanced" tab, Press the button "SFX options". The "Advanced SFX Options" dialog box appears.

On the "General" tab, choose "Create in the current folder".

In the field "Run after extraction", type the name of your installer, this should be the name of your msi. Don't forget the extension ".msi". If you need to put switches, put them after .msi, as you usually do in a batch line.

4- Go to "Modes" tab, choose: Unpack to temporary folder + Hide all + Overwrite all files.

5- Press "OK' on all dialogs and wait for the compression process to complete. Close WinRAR.

You should find "AR6.exe" inside the folder you browsed to in step 1.

You need to add this line to your batch file:

start /wait %systemdrive%\Install\AR6\AR6.exe

No switches are needed, as you can see.

Link to comment
Share on other sites

wow, cool tips! :)

i was wondering, if ever i am to decide to password protect the SFX archive, would it be possible to include a commandline parameter when decompressing it from a batch file (or an automation tool like AutoIt)? :rolleyes: thanks!

Link to comment
Share on other sites

When it comes to password-protected SFX, WinRAR is easy. This option is found here:

"Archive name and parameters" dialog box --> Advanced --> Set password...

A password longer than 8 characters is much more secure.

When extracting, the password must be entered. This can be done using a VBS, a JScript, or AutoIt, depending on which one you are familiar with.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

@ViperSpeeder

Personally, I haven't faced such a problem. But I recall I read something like that posted by others.

If you face such a problem or want to make precautions, follow the following example.

That is, let RunOnceEX extract the archive without switches. Then, run your executable or MSI via a separate command line.

EXAMPLE:

REG ADD .......\MySFX.exe (without switches being put inside the SFX)

REG ADD .......\ThePathOnMyHardDisk\To\ExtractedMSI\My.msi /qb (or whatever switch)

@Adiel

I don't use XCOPY, myself.

Link to comment
Share on other sites

  • 1 year later...

You can put any standalone apps in a folder called

APPS and any shortcuts inside folders named for that app

and put THOSE fiolders all into a folder called SC

Then the below script can be run, just put APPS

and SC folders in the same folder as the script.

This way you have no scripting to do! Just make sure

your shortcut (for start menu) goes into its own folder

like Adobe, Cyberlink, Acme, or whatever and THAT

goes into the SC folder, then APPS has a folder, say

"Aida32" and in there is the EXE the shortcut relates to,

its a bit of a pain because you have to make the shortcut

initially by having the app in your own program files to begin

with, but that shortcut, once created, can be placed into

the distribution folder.

Script...

XCOPY APPS "%PROGRAMFILES%" /i /s /e /r /v /k /f /c /h /y
XCOPY SC "%ALLUSERSPROFILE%\Start Menu\Programs" /i /s /e /r /v /k /f /c /h /y

Two simple lines of code!

This is a foolproof method for AFTER Windows has installed

in case, like you said, some files in $Progs and $Docs do not

copy over :realmad: **** Microsoft.

Here are a lot of progs that are standalone...

Aida32

CPU-Z

CWS Shredder

Disk Speed

DLL Viewer

eMule

HijackThis

Media Player Classic

uTorrent

Regmon (any sysinternals progs you care to add in fact!)

RAM Tester

Space Monger

TCP View

VirtualDub

All of which do not touch your registry!

Just copy over to use!!

Edited by LeveL
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...