Copying a folder first in an SR action

You need help to start using UVK? You have a doubt on a UVK feature? Post here!
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Copying a folder first in an SR action

Post by Xander »

I'm setting up a UVKSR file for Repairs and Tweaking.com's tool is one of the very few I know of that won't run from a network location. So, the current plan is to update the zip, unzip it on the NAS, copy that folder to the C: and then run it there.

From the UVKSR:

Code: Select all

[Tweaking.com's Repair (auto)]
Description=Hundreds of settings returned to their defaults
FileName=%installsourcedir%\Third Party\Tweaking.zip
Url=http://www.tweaking.com/files/setups/tweaking.com_windows_repair_aio.zip
LinkText=
Command1=copy %installsourcedir%\Third Party\Tweaking.com - Windows Repair\*.* C:\support\UVK\Tweaking.com - Windows Repair\ /s
Command1Flag=0
Command2=c:\support\UVK\Tweaking.com - Windows Repair\Repair_Windows.exe /silent
Command2Flag=2
Command3=
Command3Flag=0
Command4=
Command4Flag=0
Pretty sure the problem is in the attempt to copy but I'm not completely sure how (or if) this can be done within this context.
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Copying a folder first in an SR action

Post by Charger440 »

Xander wrote:I'm setting up a UVKSR file for Repairs and Tweaking.com's tool is one of the very few I know of that won't run from a network location. So, the current plan is to update the zip, unzip it on the NAS, copy that folder to the C: and then run it there.

From the UVKSR:

Code: Select all

[Tweaking.com's Repair (auto)]
Description=Hundreds of settings returned to their defaults
FileName=%installsourcedir%\Third Party\Tweaking.zip
Wouldn't this extract to: %installsourcedir%\Third Party\Tweaking\ ??

Code: Select all

Url=http://www.tweaking.com/files/setups/tweaking.com_windows_repair_aio.zip
LinkText=
Command1=copy %installsourcedir%\Third Party\Tweaking.com - Windows Repair\*.* C:\support\UVK\Tweaking.com - Windows Repair\ /s
Command1Flag=0
Command2=c:\support\UVK\Tweaking.com - Windows Repair\Repair_Windows.exe /silent
Command2Flag=2
Command3=
Command3Flag=0
Command4=
Command4Flag=0
Pretty sure the problem is in the attempt to copy but I'm not completely sure how (or if) this can be done within this context.
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Copying a folder first in an SR action

Post by Charger440 »

This might be a good place to mention this. Fred, can you make scripting, particularly the errors more transparent? Seems like more often than not it's hard to tell what the error actually was. I don't know if you can or not but it might be nice if you could.
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Fred
Site Admin
Posts: 2360
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Copying a folder first in an SR action

Post by Fred »

Xander, there are at least four critical errors in your copy command.

1: The first token of a command must be an expression that evaluates to the the path of an executable. Now "copy" does not evaluate to the path of an executable, so the command fails. It should be something like "cmd.exe /c copy", or "%ComSpec% /c copy".

2: The copy command only copies files. It does not copy directories or sub directories, nor does it create the destination directory. In this case you should use Xcopy.

3: The source and destination paths contain white spaces, and are not enclosed with double quotes. The command would never work this way.

4: %InstallSourceDir%\Third Party\Tweaking.zip extracts to %InstallSourceDir%\Third Party\Tweaking, like Jim mentioned. The extraction directory is exactly the same path as the zip file, with the '.zip' extension part stripped out.

So you just need to edit your command1 as follows:

Code: Select all

%ComSpec% /c Xcopy "%InstallSourceDir%\Third Party\Tweaking" "C:\support\UVK" /s /q /h /i /y
Leave your command2 as it is, it should be fine.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Copying a folder first in an SR action

Post by Xander »

Yeah, I had corrected the directory part - I was trying to keep the paths short but meaningful.
Jim, the zip contains a long folder name right off the bat so keeping the paths limited has its advantages.

And like I said, I sure the big problem was in the copy (otherwise there would be a folder created in the c:\Support\uvk folder). My batch file experience is limited and I've never gotten the hang of ComSpec; barely ever used xcopy.

Success - even if the math is a little off:
Image
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Copying a folder first in an SR action

Post by Charger440 »

Xander

My point was, in your copy script you don't use the name of the folder. Anytime UVK unzips it used the file name.

For example thisfolder.zip extracts to thisfolder\

Your copy from path should have read %installsourcedirectory%\thisfolder\ and it did not. However with the other things that Fred pointed out, just my comment alone would not have fixed the issue for you.

If you follow Fred's reply it will work just fine :)
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Copying a folder first in an SR action

Post by Xander »

It works because the -only- contents of the zip is a folder containing all the other files. So, it extracts to \Tweaking\ but, when copied, takes the unzipped folder and runs that from the C: drive.
I could have included the \Tweaking\ in the path but it was unnecessary.
Fred
Site Admin
Posts: 2360
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Copying a folder first in an SR action

Post by Fred »

I figured out the reason for the "212 out of 4 actions successfully executed" bug.

My _UnzipFile() function returns the number of items extracted from the zip. I was adding the returned value to the number of actions successfully executed. So this could read 208 files extracted and 4 actions succeeded. Weird, huh? Its' fixed now, thanks.

%ComSpec% is just a global Windows environment variable which expands to C:\Windows\System32\cmd.exe.

You can achieve the same effect using just cmd.exe, but I prefer to use comspec because some malware tend to name their files cmd.exe too.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Copying a folder first in an SR action

Post by Xander »

The 212 wasn't a big deal. I figured it was counting files rather than actions so...no sweat.
Post Reply