command line (WinXP) 
Author Message
 command line (WinXP)

Hello, All!

I have made a module(see below) and have discovered a strange behaviour in
comand line mode:

=========Beginning of the citation==============
C:\...y Music\Katatonia\Last Fair Deal Gone Down>dir "/p"
 Volume in drive C has no label.
 Volume Serial Number is 0C80-479F

 Directory of C:\

File Not Found
=========The end of the citation================

When I use _dir /p_ everything is OK.

=========Beginning of the citation==============
C:\...y Music\Katatonia\Last Fair Deal Gone Down>dir /p
 Volume in drive C has no label.
 Volume Serial Number is 0C80-479F

 Directory of C:\Documents and Settings\rc\My Documents\My
Music\Katatonia\Last Fair Deal Gone Down

06.07.2003  09:42    <DIR>          .
06.07.2003  09:42    <DIR>          ..
05.07.2003  10:17         1 801 345 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Chrome[-+m
ark+-]2[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:25         1 577 448 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Clean Toda
y[-+mark+-]7[-+mark+-]2001[-+mark+-]Metal.ogg
05.07.2003  10:19         1 921 208 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Disposessi
on[-+mark+-]1[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:27         1 972 274 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Don`t Tell
 A Soul[-+mark+-]11[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:32         2 007 636 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]I Transpir
e[-+mark+-]5[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:33         1 269 293 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Passing Bi
rd[-+mark+-]9[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:35         1 343 946 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Sweet Nurs
e[-+mark+-]10[-+mark+-]2001[-+mark+-]Metal.ogg
05.07.2003  10:20         1 180 590 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Teargas[-+
mark+-]4[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:36         1 845 629 Katatonia[-+mark+-]Last Fair Deal Gone D
own[-+mark+-]The Future
 Of Speech[-+mark+-]8[-+mark+-]2001[-+mark+-]Metal.ogg
06.07.2003  09:37         1 399 310 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]Tonight`s
Music[-+mark+-]6[-+mark+-]2001[-+mark+-]Metal.ogg
05.07.2003  10:21           914 480 Katatonia[-+mark+-]Last Fair Deal Gone
Down[-+mark+-]We Must Bu
ry You[-+mark+-]3[-+mark+-]2001[-+mark+-]Metal.ogg
              11 File(s)     17 233 159 bytes
               2 Dir(s)  14 596 743 168 bytes free
=========The end of the citation================

So, why _dir /p_ and _dir "/p"_ work not identically? Whereas _ren 1 2_ and
_ren "1" "2"_ work identically.

_The module:_
=========Beginning of the citation==============
from os import system

#example cmd='copy',args=['c:\\1.txt','1-2 3.txt']
#= os.system('copy' + ' \"' + 'c:\\1.txt' + '\"' + ' \"' + 'c:\\1.txt')
#=copy "c:\1.txt" "1-2 3.txt"
def myossystem(cmd,args=[]):
    for i in args:
        cmd=cmd+' \"'+i+'\"'
    system(cmd)

if __name__ == '__main__':
    myossystem('dir', ['/p'])

    #while 1:pass
=========The end of the citation================




Thu, 22 Dec 2005 10:04:44 GMT  
 command line (WinXP)
Hello Egor,
Quote:
> So, why _dir /p_ and _dir "/p"_ work not identically? Whereas _ren 1 2_ and
> _ren "1" "2"_ work identically.

In windows, the expansion of wildcards and special characters is done
by the program and not by the shell.
This means that in the first usage dir sees a /p parameter where in the 2'nd
usage it looks for a file named "/p".

HTH.
Miki



Thu, 22 Dec 2005 18:13:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WinXP - How to place image in line with drop-down menu

2. Slow "recording" on winXP Command

3. MSWLogo 6.4h - setfont command fails - WinXP Pro

4. MSWLogo 6.4h - setfont command fails - WinXP Pro

5. Inconsistent file command behaviour on WinXP

6. How to write accent in WinXP Command Prompt ?

7. reading a line and executing a command on that line

8. Win2000 Gawk Renaming a file with system() command, command line to long

9. command environments and command line arguments

10. Command line variables to executables,command programs

11. command line options for old viscob and vclink commands

12. command line command structure representation

 

 
Powered by phpBB® Forum Software