Powershell batch to run FastCopy elevated for command line

1,076 views
Skip to first unread message

kaza...@gmail.com

unread,
Sep 6, 2016, 1:01:03 PM9/6/16
to FastCopy bulletin board, robert...@orixgeo.com
Hi All,

I have 100's of thousands of files in a very deep and complex folder structure where many paths exceed MAX_PATH. I also have a subset of 10's to 100's of thousands of files that need to be moved to another root folder while maintaining the full path (where many exceed MAX_PATH), moving all files in a folder is the exception to the rule. I have been trying to use a PowerShell script to bath move each file but regardless of the command I send FastCopy it gives me an 'Illegal Command' error window stating the string in $args 'is not recognised.' It prints out the entire string and I can't find an issue with it, it looks just like it should based on how it is built in the code. I have tried using fewer switches and varying the number of " around the paths but to no avail. Since the folder structure to each file needs to be maintained I am looping through each file and starting a new instance of fastopy and closing it, I know this isn't the most efficient method but I don't know of another method. For testing purposes I am only looping through 5 entries in the srcFile

I am currently thinking it is a permissions issue where fastcopy is not running in Elevated mode. Is there a way to ensure FastCopy runs Elevated from the command line?

Any other thoughts?



# list of full paths one per line
$srcFile
= get-content -path "C:\...\srcFile.txt"

# list of folders one per line
$destFile
= get-content -path "C:\...\destFile.txt"

for ($index=0; $index -le 4; $index++){
 $i
= $index
 $src
= $srcFile[$i+1]
 $dest
= $destFile[$i+1]

 
#$args = ('/cmd=move','/auto_close','/no_ui','/bufsize=1024','/speed=full','/verify','/acl',$src,'/To='+$dest)
 $args
= ('/cmd=move /acl """"'+$src+'"""" /To=""""'+$dest+'""""')

& 'C:\Program Files\FastCopy\FastCopy.exe' $args

Hiroaki SHIROUZU

unread,
Sep 7, 2016, 2:32:18 AM9/7/16
to fastcop...@googlegroups.com, robert...@orixgeo.com
(Your sentences and paragraphs are too long for me. I have wrote a important notice in BBS header.)

Sorry, I don't know about PowerShell.

And automatic(without user confirmation) elevating is not impossible. (If it is possible, it means security hole)

If you want to use elevated FastCopy, you must kick FastCopy by admin privilege.
For example, kick it in the cmd.exe(in admin mode), or register task(with run as admin) in shceduler.
Reply all
Reply to author
Forward
0 new messages