jsnyder213

Copy from Disc

7 posts in this topic

I am creating a deployable disc that user without admin rights can use to install software on a network computer. I have the entire code scripted and working except one little part. The last part of the install is to copy a file structure from the dis to the C:\ of the computer.

I know how to do this with CMD (copy " current file path " "C:\ where I want it copied to")

So, I tried: RunWait(@ComSpec & ' copy  ' & $sDrive "\ArcGIS\Desktop\DNRGPS" "C:\")

$sDrive = the drive of the CDROM that the disc is in. I need this in another part of the code to run the .exe properly. $sDrive is going to be based on the machine that the disc is in at the time... SOOO... I need to copy the file from the disc ($sDrive\ArcGIS\Desktop\DNRGPS) to the local C:\ of the machine.

Any thoughts on how I can accomplish this? My attempt... failed. :(

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First off, this:

RunWait(@ComSpec & ' copy  ' & $sDrive "\ArcGIS\Desktop\DNRGPS" "C:\")

should be more like this (you forgot an & after $sDrive):

Run(@ComSpec & " /c " & 'copy  ' & $sDrive & "\ArcGIS\Desktop\DNRGPS C:\", "", @SW_HIDE)

Secondly, if you're asking how to figure out what drive is the CD-ROM, look at the example for DriveGetDrive in the help file. You would enumerate all drives, then set the one that is "CDROM" to your $sDrive value.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

First off, this:

RunWait(@ComSpec & ' copy  ' & $sDrive "\ArcGIS\Desktop\DNRGPS" "C:\")

should be more like this (you forgot an & after $sDrive):

Run(@ComSpec & " /c " & 'copy  ' & $sDrive & "\ArcGIS\Desktop\DNRGPS C:\", "", @SW_HIDE)

Secondly, if you're asking how to figure out what drive is the CD-ROM, look at the example for DriveGetDrive in the help file. You would enumerate all drives, then set the one that is "CDROM" to your $sDrive value.

Good catch... but I don't think that is it. I have tested it with the change you suggested... and I think it is stuck in limbo, becasue I have not got an error code or anything.

I removed the " " and @SW_HIDE and ran it, and it just launches CMD window. It does not actually use the command prompt.

I used the DriveGetDrive in my "main" code. I just needed to figure out how to incorporate the variable that is set by DriveGetDrive in the $sDrive value into my 'copy' command.

if I was doing it via CMD I would type Copy E:\ArcGIS\Desktop\DNRGPS C:\ ... I need to figure out how to script that statement.

Share this post


Link to post
Share on other sites

change the /c to /k to keep the command line window open, since you already removed the @SW_HIDE. That way you can see if there is a console error happening.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

change the /c to /k to keep the command line window open, since you already removed the @SW_HIDE. That way you can see if there is a console error happening.

​Whoops. I totally did not see that you added " /c "... thus I was nto seeing anything.

It works... however, it is copying all the files individually, instead of the "main" folder titled DNRGPS. This may be an issue with a missing switch or something... So I will see what I can find.

Thanks!

Share this post


Link to post
Share on other sites

Did you tried the DirCopy function?

;~ Function DirCopy("source dir", "dest dir" [, flag = 0])
DirCopy($sDrive & "\ArcGIS\Desktop\DNRGPS", @HomeDrive)

 

Share this post


Link to post
Share on other sites

Did you tried the DirCopy function?

;~ Function DirCopy("source dir", "dest dir" [, flag = 0])
DirCopy($sDrive & "\ArcGIS\Desktop\DNRGPS", @HomeDrive)

 

​I did not. I was able to get it working with what JLogan suggested, but this seems like a viable option as well. I may play around with this solution, just to see if it would work as well. In fact it may be "cleaner" than running a script from CMD, like I currently have it doing.

Thanks for the input!

Share this post


Link to post
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