2012-06-01 1 views
1

파일 이름을 제공하고 확장명을 제공하지 않고 .bat 파일을 열려면 어떻게해야합니까? Windows에서 사용할 응용 프로그램을 결정하도록하고 싶습니다.이름으로 만 파일 열기, 확장자 없음

예 :

% SYSTEMROOT % \ explorer.exe를 E : \ SomeFolder

퍼센트 SYSTEMROOT \ % \ explorer.exe를 E : \ SomeFolder 파일 1

+1

이것은 분명하지 않습니다. Windows는 확장 프로그램을 기반으로 사용할 프로그램을 결정합니다. 또한 확장명은 파일 이름의 일부이며 규칙이기도합니다. "파일의 전체 이름없이 파일을 열려면 어떻게해야합니까?"라고 묻는 중입니다. – vcsjones

+0

엑셀 파일을 열어야하고, 파일이 .xlsx 또는 .xls로 끝나는 날씨를 알지 못합니다. – jadrijan

+1

두 확장 프로그램 모두 Excel을 실행해야합니다. 둘 중 하나 또는 둘 모두가 수정되지 않으면 수정 될 수 있습니다. Windows 탐색기에서 "깨진"파일 중 하나를 마우스 오른쪽 단추로 클릭하고 연결 프로그램을 선택하고 응용 프로그램 목록에서 Excel을 선택하고 "이 응용 프로그램을 항상 사용"확인란을 선택한 다음 확인을 클릭합니다. – Tom

답변

1

사용 명령 START : \

start "Any title" E:\SomeFolder\ 
start "Any title" E:\SomeFolder\file1 
시작 도움말에서 촬영 :

If Command Extensions are enabled, external command invocation 
through the command line or the START command changes as follows: 

.

non-executable files may be invoked through their file association just 
    by typing the name of the file as a command. (e.g. WORD.DOC would 
    launch the application associated with the .DOC file extension). 
    See the ASSOC and FTYPE commands for how to create these 
    associations from within a command script. 

.

When searching for an executable, if there is no match on any extension, 
then looks to see if the name matches a directory name. If it does, the 
START command launches the Explorer on that path. If done from the 
command line, it is the equivalent to doing a CD /D to that path. 

앞의 설명은 순수한 파일 이름이 START 명령없이 올바른 응용 프로그램을 실행해야 함을 의미합니다.

for %%f in (name.*) do set "filename=%%f" & goto continue 
:continue 
을 ... 그리고 그것을 실행 : 주어진 이름으로 첫 번째 파일을 선택하기

%filename% 

PS는 - 당신이 원하는합니다 "창을 사용하는 응용 프로그램을 결정하게합니다" 귀하의 예에서는 명시 적으로 %SystemRoot%\explorer.exe을 사용할 응용 프로그램으로 선택합니다. 그래서?