Jump to content











Photo
- - - - -

Program association error when running script


  • Please log in to reply
4 replies to this topic

#1 brianpaul

brianpaul

    Member

  • Members
  • 43 posts
  •  
    United States

Posted 04 June 2012 - 12:20 PM

I am trying to make a script that deletes and copies files to my usb device, but I get the following error.

"This file does not have a program associated with it for performing this action. Please install a program or, if one is installed, create an association in the Default Programs control panel."

The file is robocopy.exe and it is attached to the script in a folder called CopyToUSB. Here is the code I have...


If,ExistDir,%ProjectTemp%\CopyToUsb,Shellexecute,Hide,cmd.exe,"/C rd /s /q #$q%ProjectTemp%\CopyToUsb#$q"

If,ExistDir,%ProjectTemp%\CopyToUsb,Echo,"%ProjectTemp%\CopyToUsb  Folder can not be deleted",Warn

If,ExistDir,%ProjectTemp%\CopyToUsb,Message,"%ProjectTemp%\CopyToUsb  Folder can not be deleted",Error

If,ExistDir,%ProjectTemp%\CopyToUsb,Halt,"ProjectTemp\CopyToUsb Folder can not be deleted"

DirMake,%ProjectTemp%\CopyToUsb

ExtractAllFiles,%ScriptFile%,CopyToUsb,%ProjectTemp%\CopyToUsb

Shellexecute,Hide,cmd.exe,"/C rd /s /q #$q%pFileBox1%\Boot#$q"

Shellexecute,Hide,cmd.exe,"/C rd /s /q #$q%pFileBox1%\Programs#$q"

Shellexecute,Hide,cmd.exe,"/C rd /s /q #$q%pFileBox1%\sources#$q"

FileDelete,%pFileBox1%\BOOTMGR

FileDelete,%pFileBox1%\CdUsb.Y

FileDelete,%pFileBox1%\grldr

FileDelete,%pFileBox1%\menu.lst

FileDelete,%pFileBox1%\Win7PE.cd

ShellExecute,%OpenHide%,%ProjectTemp%\CopyToUsb\robocopy.exe,"#$q%TargetDir%#$q #$q%pFileBox1% #$q /MIR /FFT"


I get this error on the last line of code. Can anyone tell me what I'm doing wrong?
Thanks!

#2 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 04 June 2012 - 03:31 PM

The last line contains a syntax error.

Remove the space in #$q%pFileBox1% #$q

Peter

#3 brianpaul

brianpaul

    Member

  • Members
  • 43 posts
  •  
    United States

Posted 04 June 2012 - 03:40 PM

Oops! Ok, I removed the space, but I'm still getting the same error.

#4 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 04 June 2012 - 03:41 PM

I think it's because you're not setting the %OpenHide% parameter ;)

So, for example, this works fine:
Set,%OpenHide%,Open

ShellExecute,%OpenHide%,%ProjectTemp%CopyToUsbrobocopy.exe,"#$q%TargetDir%#$q #$q%pFileBox1% #$q /MIR /FFT"


#5 brianpaul

brianpaul

    Member

  • Members
  • 43 posts
  •  
    United States

Posted 04 June 2012 - 04:07 PM

That's it... thanks amalux!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users