Programing

시작된 프로그램에 전달 된 매개 변수와 함께 "start"명령 사용

lottogame 2020. 4. 28. 08:17
반응형

시작된 프로그램에 전달 된 매개 변수와 함께 "start"명령 사용


Virtual PC 2007에 가상 컴퓨터가 있습니다.

데스크탑에서 시작하려면 배치 파일에 다음 명령이 있습니다.

"c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch

그러나 가상 컴퓨터가 종료 될 때까지 호스트 컴퓨터에 dos 프롬프트가 남고 가상 PC 콘솔을 종료합니다. 그거 짜증나네.

그래서 대신 START 명령을 사용하도록 명령을 변경했습니다.

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc MY-PC -launch

그러나 가상 PC에 전달 된 매개 변수를 질식시킵니다.

START /?매개 변수가 실제로 해당 위치로 이동했음을 나타냅니다. 누구든지 START를 사용하여 여러 명령 줄 인수가있는 프로그램을 시작 했습니까?


START는 첫 번째 매개 변수 주위에 큰 따옴표가 포함되어 있습니다. 첫 번째 매개 변수에 큰 따옴표가 있으면이를 새 창에 대한 선택적 TITLE로 사용합니다.

나는 당신이 원하는 것이 믿습니다.

start "" "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc MY-PC -launch

즉, 프로그램 이름 앞에 빈 제목을 지정하여 가짜로 만듭니다.


배치 파일 대신 바탕 화면에 바로 가기를 만들 수 있습니다.

대상을 다음으로 설정하십시오.

"c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch

그리고 당신은 모두 설정되었습니다. 명령 프롬프트를 시작하여 시작하지 않기 때문에 DOS Box가 없습니다.


공백은 DOS / CMD 문제이므로 다음을 통해 경로로 이동해야합니다.

cd "c:\program files\Microsoft Virtual PC"

다음을 통해 VPC를 시작하십시오.

start Virtual~1.exe -pc MY-PC -launch

~1처음에 처음 exe의미합니다 "Virtual". 따라서 a "Virtual PC.exe"와 a 가 있으면 "Virtual PC1.exe"Virtual~1.exe번째 Virtual~2.exe두 번째 등이 있습니다.

또는 VirtualBox와 같은 VNC 클라이언트를 사용하십시오.


"특이성"의 대답은 정확하며 질문에 직접 대답합니다. TimF가 대답했듯이 첫 번째 매개 변수는 따옴표로 묶여 있으므로 창 제목으로 취급됩니다.

또한 가상 PC 옵션은 'start'명령 자체에 대한 옵션으로 취급되며 'start'에는 유효하지 않습니다. 'start'명령이있는 모든 버전의 Windows에 해당됩니다.

인용 된 매개 변수를 제목으로 취급하는 '시작'과 관련된이 문제는 게시 된 문제보다 훨씬 성가시다. 이것을 실행하면 :

start "some valid command with spaces"

창 제목에 대한 명백한 결과와 함께 새로운 명령 프롬프트 창이 나타납니다. 더 성가신이 새 창은 사용자 정의 글꼴, 색상 또는 창 크기를 상속하지 않으며 cmd.exe의 기본값입니다.


매개 변수에 큰 따옴표를 사용해야하는 경우 " 'c : \ somepath'는 내부 또는 외부 명령, 실행 가능한 프로그램 또는 배치 파일로 인식되지 않습니다"라는 오류가 발생할 수 있습니다. 이중 인용 부호를 사용할 때 아래 솔루션을 제안합니다. https://stackoverflow.com/a/43467194/3835640


경로 + 프로그램이 아닌 경로 지정 에만 [ /D"Path"] 사용 을 사용하여 따옴표를 사용할 수 있습니다 . 뒤에 나오는 동일한 줄의 모든 코드는 정상적인 경로로 돌아가서 경로와 파일을 분리 할 필요가없는 것으로 보입니다./D

    start  /D "C:\Program Files\Internet Explorer\" IEXPLORE.EXE

또는:

    start  /D "TITLE" "C:\Program Files\Internet Explorer\" IEXPLORE.EXE

기본 웹 페이지로 IE를 시작합니다.

    start  /D "TITLE" "C:\Program Files\Internet Explorer\" IEXPLORE.EXE www.bing.com

Bing으로 시작하지만 홈페이지를 재설정하지는 않습니다.

/D "디렉토리"를 나타내며 따옴표를 사용하는 것이 좋습니다!

잘못된 예 :

    start  /D "TITLE" "C:\Program Files\Internet Explorer\IEXPLORE.EXE"

제공합니다 :

ERROR " 현재 디렉토리가 유효하지 않습니다. "

/D must only be followed by a directory path. Then space and the batchfile or program you wish to start/run

Tested and works under XP but windows Vista/7/8 may need some adjustments to UAC.

-Mrbios


None of these answers worked for me.

Instead, I had to use the Call command:

Call "\\Path To Program\Program.exe" <parameters>

I'm not sure this actually waits for completion... the C++ Redistributable I was installing went fast enough that it didn't matter


If you want passing parameter and your .exe file in test folder of c: drive

start "parameter" "C:\test\test1.exe" -pc My Name-PC -launch

If you won't want passing parameter and your .exe file in test folder of c: drive

start "" "C:\test\test1.exe" -pc My Name-PC -launch

If you won't want passing parameter and your .exe file in test folder of H: (Any Other)drive

start "" "H:\test\test1.exe" -pc My Name-PC -launch


"/b" parameter

start /b "" "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch


have you tried:

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe" "-pc MY-PC -launch"

?


Put the command inside a batch file, and call that with the parameters.

Also, did you try this yet? (Move end quote to encapsulate parameters)

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe -pc MY-PC -launch"

Change The "Virtual PC.exe" to a name without space like "VirtualPC.exe" in the folder. When you write start "path" with "" the CMD starts a new cmd window with the path as the title. Change the name to a name without space,write this on Notepad and after this save like Name.cmd or Name.bat:

CD\
CD Program Files
CD Microsoft Virtual PC
start VirtualPC.exe
timeout 2
exit

This command will redirect the CMD to the folder,start the VirualPC.exe,wait 2 seconds and exit.

참고URL : https://stackoverflow.com/questions/154075/using-the-start-command-with-parameters-passed-to-the-started-program

반응형