jsnyder213 Posted May 12, 2015 Share Posted May 12, 2015 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 12, 2015 Moderators Share Posted May 12, 2015 (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 May 12, 2015 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jsnyder213 Posted May 12, 2015 Author Share Posted May 12, 2015 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 12, 2015 Moderators Share Posted May 12, 2015 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jsnyder213 Posted May 12, 2015 Author Share Posted May 12, 2015 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! Link to comment Share on other sites More sharing options...
DarkwarlorD Posted May 13, 2015 Share Posted May 13, 2015 Did you tried the DirCopy function?;~ Function DirCopy("source dir", "dest dir" [, flag = 0]) DirCopy($sDrive & "\ArcGIS\Desktop\DNRGPS", @HomeDrive) Link to comment Share on other sites More sharing options...
jsnyder213 Posted May 13, 2015 Author Share Posted May 13, 2015 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now