topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 11:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: sike 1.0 - send file(s) to recycle bin via command line  (Read 18084 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
sike is a command line .exe that sends files/folders to the recycle bin.

Download:  http://www.favessoft.com/downloads.html

Just copy sike.exe to a folder in your path.
sike creates no files, registry or .ini settings.

sike with no params brings up a usage dialog.

Usage: sike [-f] filename1 filename2 ... [may use wildcards]

If -f is not the first param, a confirmation dialog will display,
otherwise sike will loop through the rest of the params sending
files/folders to the recycle bin.

It should work on any Windows flavor that the latest AutoIt3 works on.

It is free for you to use at your own risk.

(There may be a bunch of these around already but I didn't find one that
worked on Vista64 out of the box.  So I knocked this off in AutoIt3.)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #1 on: May 12, 2010, 09:50 AM »
thanks for sharing  :up:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #2 on: May 12, 2010, 01:17 PM »
:)

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #3 on: June 11, 2010, 03:51 AM »
excellent idea

majoMO

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 45
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #4 on: June 11, 2010, 07:02 AM »
Hi MilesAhead,

FYI, it doesn't work if the filename has some uncommon characters, like: á - ô - ü

E.g.: "mçfilè.txt"

EDIT: if  use it in a .bat file doesn't work - if I use it in a command prompt no annoyances...
« Last Edit: June 11, 2010, 07:08 AM by majoMO »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #5 on: June 11, 2010, 01:20 PM »
excellent idea

Thank you. :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #6 on: June 11, 2010, 01:40 PM »
Hi MilesAhead,

FYI, it doesn't work if the filename has some uncommon characters, like: á - ô - ü

E.g.: "mçfilè.txt"

EDIT: if  use it in a .bat file doesn't work - if I use it in a command prompt no annoyances...

Thanks for reporting that info.  On the special characters I believe that is because AutoIt3 itself is ansi. It doesn't support unicode afaik. The command line parsing is a built in feature where you are presented with an array of the command line args: $CmdLine where the first element is the count and the rest of the elements correspond to an arg.  I don't know if there's any easy way to correct it. I'll see if I can find a fix on AutoIt3 forum.

As for the batch file, what kind of error do you get?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #7 on: June 11, 2010, 02:38 PM »
Hmmmm, I don't seem to be having much luck with the unicode.  I found some posts on AutoIt3 forum and it seems there's confusion if the command prompt or run box support unicode or what the issue is. There doesn't seem to be a simple way to accommodate it that I can find at present.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #8 on: June 11, 2010, 03:21 PM »
If you are willing to try some test apps I can try a few things out.  To be honest though, unicode is new to me.  I've just done stuff for English language and ansi.

I compiled this test app with a unicode directive.  I'd like to see if it actually has any effect.  All it does is pop up a box with the command line arguments displayed.

TestCmdLine one two three

but with args that have unicode characters should test if this approach is feasible.

If run with no args it just pops up a MsgBox with Usage: msg.

The zip just contains the compiled AutoIt3 script(without any UPX compression)

(edit: actually the directive was to use UTF-8.)

« Last Edit: June 11, 2010, 03:26 PM by MilesAhead »

majoMO

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 45
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #9 on: June 11, 2010, 04:11 PM »
As for the batch file, what kind of error do you get?

No error at all. It just doesn't copy to recycle bin only.

  • TestCmdLine

Bat file with:TestCmdLine.exe sike.exe "mçfilè.txt":



Bat file with:TestCmdLine.exe sike.exe "my.txt":



  • All-round

If I use a .bat file I need to use this to work well:

@echo off
for /f "tokens=2 delims=:" %%a in ('2^>nul chcp') do set cp=%%a
>nul 2>&1 chcp 1252

sike.exe "mçfilè.txt"
>nul 2>&1 chcp%cp%
exit

If I use only «sike.exe "mçfilè.txt"» it doesn't work.

Hope this help.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #10 on: June 11, 2010, 04:45 PM »
Not sure if this would help, but is the batch file itself saved in Unicode or ANSI?

By the way, AutoIt3 has supported Unicode since version v3.2.4.0 but I too don't have much experience with trying to use it in DOS :-[ the command prompt.  

Nice workaround, majoMO!

« Last Edit: June 11, 2010, 04:50 PM by daddydave »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #11 on: June 11, 2010, 05:19 PM »
(delete please)
« Last Edit: June 11, 2010, 05:29 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #12 on: June 11, 2010, 05:27 PM »

As for the batch file, what kind of error do you get?

No error at all. It just doesn't copy to recycle bin only.

  • TestCmdLine

Bat file with:TestCmdLine.exe sike.exe "mçfilè.txt":



Bat file with:TestCmdLine.exe sike.exe "my.txt":



  • All-round

If I use a .bat file I need to use this to work well:

@echo off
for /f "tokens=2 delims=:" %%a in ('2^>nul chcp') do set cp=%%a
>nul 2>&1 chcp 1252

sike.exe "mçfilè.txt"
>nul 2>&1 chcp%cp%
exit

If I use only «sike.exe "mçfilè.txt"» it doesn't work.

Hope this help.

Ok so you are saying you have to use the batch file work-around no matter which program you use in the batch?  If that's the case then it looks like the UTF-8 directive is worthless.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #13 on: June 11, 2010, 05:30 PM »
Not sure if this would help, but is the batch file itself saved in Unicode or ANSI?

By the way, AutoIt3 has supported Unicode since version v3.2.4.0 but I too don't have much experience with trying to use it in DOS :-[ the command prompt. 

Nice workaround, majoMO!



You're right. I confused this with an issue I had with ahk.  AutoIt3 no longer supports Win9x etc..

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #14 on: June 11, 2010, 05:34 PM »
What they say on AutoIt3 forum seems to indicate the command prompt and run box don't support unicode.

majoMO

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 45
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #15 on: June 11, 2010, 05:47 PM »
Sorry but seems that I don't understand (the boxes that comes out are in screenshots).   ::)

What I do is (in .bat):
TestCmdLine.exe sike.exe "mçfilè.txt"

Output:
-[0]|2
-[1]|sike.exe
-[2]|mþfilÞ.txt

In start > run > cmd :
TestCmdLine.exe sike.exe "mçfilè.txt"

Output:
-[0]|2
-[1]|sike.exe
-[2]|mçfilè.txt

If this isn't what I should to do please give me an example (english isn't my native language....).   :stars:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #16 on: June 11, 2010, 05:52 PM »
If daddydave and the guys at AutoIt3 forum are right and the issue is the command prompt, maybe this page will be more helpful:

http://www.dpawson.c...l/sect2/Unicode.html

Supposedly it fixes up the command prompt to deal with UTF-8.

edit: I've been looking around for a freeware command shell for Windows with unicode support but so far I haven't found anything.

majoMO

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 45
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #17 on: June 11, 2010, 06:00 PM »
It seems that the problem is with OEM encoding (and DOS...).

This info could be useful: http://stackoverflow...age-is-cmd-exe-using

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #18 on: June 11, 2010, 06:08 PM »
If daddydave and the guys at AutoIt3 forum are right

I don't know enough about the subject to have an opinion but it interests me and I'm glad you're digging into it.  I'm thinking this probably impacts the command line mode of my NANY 2011 project as well.

What if the command is launched from FARR and the command line args go there?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #19 on: June 11, 2010, 06:24 PM »
If daddydave and the guys at AutoIt3 forum are right

I don't know enough about the subject to have an opinion but it interests me and I'm glad you're digging into it.  I'm thinking this probably impacts the command line mode of my NANY 2011 project as well.

What if the command is launched from FARR and the command line args go there?

majoMO's TestCmdLine example seems to work fine from FARR.
edit: well, the filename looks like it should. I just pasted from the page here.
But I get some sort of transparent window that disappears only when I close FARR.
Who knows?

« Last Edit: June 11, 2010, 06:26 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #20 on: June 11, 2010, 06:29 PM »
The funny thing is the whole program is only 20 lines of code.  To get it to work with non English environment will probably end up being 80 screens. :)

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #21 on: June 11, 2010, 06:33 PM »
So the reason it gives me no problem in Windows 7 x64 is that I have a U.S. version?

Screenshot - 6_11_2010 , 7_30_06 PM.png

Screenshot posted for your amusement. Yes, I still use the old COPY CON and Ctrl-Z method sometimes. :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #22 on: June 11, 2010, 06:35 PM »
When I follow the instructions on that Unicode page I posted, making a cmd prompt using Lucinda font etc... it works on the command line.  At least with the mçfilè.txt file by itself at any rate.

edit: the prompt seems to be persistent... keeping the code page setting (I assume, since the thing seems to work.. sends the file to the bin) it may be worth just making a prompt for stuff where you will use non English characters.  There must be a freebie someplace where all this is automatic. I can't believe we're the first to run into it.
« Last Edit: June 11, 2010, 06:38 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #23 on: June 11, 2010, 06:36 PM »
So the reason it gives me no problem in Windows 7 x64 is that I have a U.S. version?
 (see attachment in previous post)
Screenshot posted for your amusement. Yes, I still use the old COPY CON and Ctrl-Z method sometimes. :)

See my previous post.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: sike 1.0 - send file(s) to recycle bin via command line
« Reply #24 on: June 11, 2010, 06:38 PM »
The cmd /u? I didn't have to do anything special for it to work both on the command line or a batch file. What region is your version of Windows?
« Last Edit: June 11, 2010, 06:40 PM by daddydave »