Shell command wildcard?

AnonymousAnonymous Guest Posts: 137
How do you make a shell command use a wildcard.

Using the following I cannot get the wildcard to work.


Windir := ENVIRON('windir');
SHELL(Windir+'\notepad.exe' ,'/p','Z:\minisell\Import\*.txt');

Is there another way of doing this?

Please help.

Dan

Comments

  • toennetoenne Member Posts: 38
    you can't open more than one file with notepad.

    if you want to open each file separately with notepad, you have to use a cmd-file (i.e. mulEdit.cmd) like this
    for %%A in (%1) do call notepad %%A
    
    and call it with
    SHELL('mulEdit.cmd','/p','Z:\minisell\Import\*.txt');
    
  • AnonymousAnonymous Guest Posts: 137
    Thank you Toenne.

    But when I put in the code
    for %%A in (%1) do call notepad %%A
    
    I get a syntax error

    Dan
  • toennetoenne Member Posts: 38
    did you create a file named MulEdit.cmd with the content of the first codebox?
  • XypherXypher Member Posts: 297
    The .cmd file should work fine but then you have the concern of maybe cleaning up or waiting for the file to be created/closed etc.

    I personally would suggest using the Windows Script Host Object Model so you can:
      1. Use WSH's WshExec to execute notepad.exe 2. User WSH to scan through your designated folder(s) and *control* how, when, and if to stop at anytime etc with opening the files
Sign In or Register to comment.