Jump to content
Macro Express Forums

CMD.EXE ...Syntaxe problem? or ME problem? or else?


james123

Recommended Posts

WIN XP:

I'm trying to RENAME folder/files wich have UNICODE FORMAT: ABC月

(First, of course, I try other things, because the ME rename command does not works in this case... it returns an errors telling some chars are not ok...)

 

Exemple:

Step1: create a folder as: ABC月

Step2: use an editor wich support UNICODE format ( like NOTEPAD2 ) and make a file : d:\temp.txt with 1 line only: ABC月

Then run 3 ME commands:

VAriable Set String %T1% from file: d:\temp.txt

VAriable Set String %T2% =ABC_NEW

VAriable Set String %T3% =ren d:\"%T1%" "%T2%"

Program Launch cmd.exe /c /u %T3%

=code: <TVAR2:01:04:d:\temp.txt><TVAR2:02:01:ABC_NEW><TVAR2:03:01:ren d:\"%T1%" "%T2%"><LAUNCHDEL2:0:01C:\WINDOWS\system32\cmd.exe<PARAM>/c /u %T3%3>

Results: No effect ! ...don't work...

 

So, to convince myself and try to find out where is the problem , I did the followings:

- TRIAL without any unicode...only ASCII chars:

1) create folder: d:\ABC

2)run a simple dos command (first . , without /u ) (/u=unicode switch) , you can cut & paste in dos windows this:

C:\WINDOWS\system32\cmd.exe /c ren D:\ABC ABC_NEW

RESULTS: OK. rename folder succesfull

3) rename ( with windows explorer) again my folder to d:\ABC to make it ready for next trial

-Same trial as already tried above, but NO UNICODE SWITCH ...

4) make&run following ME lines:

VAriable Set String %T1% =ABC

VAriable Set String %T2% =ABC_NEW

VAriable Set String %T3% =ren d:\"%T1%" "%T2%"

Program Launch cmd.exe /c %T3%

=code: <TVAR2:01:01:ABC><TVAR2:02:01:ABC_NEW><TVAR2:03:01:ren d:\"%T1%" "%T2%"><LAUNCHDEL2:0:01C:\WINDOWS\system32\cmd.exe<PARAM>/c %T3%3>

Results: OK !

-NOW , use the /U Unicode command to SAVE a FOLDER to a FILE:

5) Make a folder as: D:\testéèàëöç and a sub folder as: D:\testéèàëöç\ABC月

6) make&run following ME lines:

VAriable Set String %T1% =D:\testéèàëöç

VAriable Set String %T2% =d:\temp.txt

VAriable Set String %T3% =dir "%T1%" /AD /B /N /S > "%T2%"

Program Launch cmd.exe /c %T3%

=code: <TVAR2:03:01:D:\testéèàëöç><TVAR2:04:01:d:\temp.txt><TVAR2:03:01:dir "%T3%" /AD /B /N /S > "%T4%"><LAUNCHDEL2:0:01C:\WINDOWS\system32\cmd.exe<PARAM>/u /c %T3%3>

Results: OK ( assuming you can edit temp.txt from an UNICODE supported editor : I get the famous ABC月 correctly !

( NOTEPAD2 : here: http://www.flos-freeware.ch/notepad2.html ( freeware licensed under the GPL ) is beautiful FAST & TINY editor, I always used ...)

- NOW back to the begining...why the first trial above not working ???

 

So, If a smart guy knows any better and can MAKE IT WORKING ?...I would really appreciate..thanks in advance. James

 

PS:

Also, another part , with UNICODE is working: Copy a file ( with unicode: ABC月 to T1 , then copy T1 to T2 then write a new file...=> WORKING OK !

<TVAR2:01:04:d:\temp.txt><TMVAR2:09:02:01:000:000:><TMVAR2:17:02:00:000:000:d:\temp.htmlF>

 

I may have 2 other options:

1) build myself a small .exe utility running on the command line to do the job...

2) google try to find such utility already made...if ANYONE KNOWS SUCH UTILITY , would be GREAT ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...