2012-01-05 27 views
9

Bir konum x.dtsx dosyasını a konumundan b konumuna kopyalamam gerekir b. x.dtsx zaten b varsados adı ve uzantıyı değişkenlere ayırmak için dos komutu

sonra b kopyalama x.dtsx yeniden adlandırma sonra, Sonra x_Standby.dtsx için x.dtsx adlandırmak gerekir

Benim geçerli kod şöyle görünür:

if exists %1 rename %1 %(should be 1_standy.extension) 
xcopy %1 %2 
+0

Ve Tekrar ediyorum: DOS CMD değildir ve '[toplu işleme] neq [toplu = dosya]' – SteveFest

cevap

34

sonra aşağıdaki isteğe bağlı sözdizimini kullanabilirsiniz (varsayılan Windows 2000 ve daha sonra olan) Komut İşlemci Uzantıları kullanıyorsanız:

%~1   - expands %1 removing any surrounding quotes (") 
%~f1  - expands %1 to a fully qualified path name 
%~d1  - expands %1 to a drive letter only 
%~p1  - expands %1 to a path only 
%~n1  - expands %1 to a file name only 
%~x1  - expands %1 to a file extension only 
%~s1  - expanded path contains short names only 
%~a1  - expands %1 to file attributes 
%~t1  - expands %1 to date/time of file 
%~z1  - expands %1 to size of file 

düzenleyiciler alçı almak için kombine edilebilir und sonuçları:

%~dp1  - expands %1 to a drive letter and path only 
%~nx1  - expands %1 to a file name and extension only 

Yani komut şuna benzer olacaktır:

if exist %2\%~nx1 ren %2\%~nx1 %~n1_standby%~x1 
+1

Teşekkür sen çok müthiş Neil Awesome –

İlgili konular