2017-04-18 87 views
0

我正在處理一個批處理文件,該文件將採用鍵盤輸入,然後根據我選擇的啓動不同的內容。我有以下我不會跑的:CD,並開始工作時,他們是孤獨的,但不是與部分。使用批處理和鍵盤輸入運行程序

set /p %environment%=Goede dag Jeroen! Wilt u beginnen met FME(f), 
AutoCAD(a), beide(b) of alleen opstart(g)? f/a/b/g : 

IF /i "%environment%" == "f" GOTO work 
IF /i "%environment%" == "a" GOTO cadprog 
IF /i "%environment%" == "b" GOTO same 
IF /i "%environment%" == "g" GOTO geen 
ECHO "Ongeldige keuze. Kies alstublief opnieuw" 
GOTO end 

:work 
cd "C:\Program Files (x86)\FME" 
start fmeworkbench.exe 

cd "C:\Program Files (x86)\Google\Chrome\Application" 
start chrome.exe 

cd "C:\Program Files (x86)\Mozilla Firefox" 
start firefox.exe 

%SystemRoot%\explorer.exe W:\DataService\Colo 

%SystemRoot%\explorer.exe W:\DataService\Colo 
goto end 

:cadprog 
cd "C:\Program Files\Autodesk\AutoCAD Map 3D 2012" 
start acad.exe 

cd "C:\Program Files (x86)\Google\Chrome\Application" 
start chrome.exe 

cd "C:\Program Files (x86)\Mozilla Firefox" 
start firefox.exe 

%SystemRoot%\explorer.exe W:\DataService\Colo 

%SystemRoot%\explorer.exe W:\DataService\Colo 
goto end 

:same 
cd "C:\Program Files\Autodesk\AutoCAD Map 3D 2012" 
start acad.exe 

cd "C:\Program Files (x86)\FME" 
start fmeworkbench.exe 

cd "C:\Program Files (x86)\Google\Chrome\Application" 
start chrome.exe 

cd "C:\Program Files (x86)\Mozilla Firefox" 
start firefox.exe 

%SystemRoot%\explorer.exe W:\DataService\Colo 

%SystemRoot%\explorer.exe W:\DataService\Colo 
goto end 

:geen 
cd "C:\Program Files (x86)\Google\Chrome\Application" 
start chrome.exe 

cd "C:\Program Files (x86)\Mozilla Firefox" 
start firefox.exe 

%SystemRoot%\explorer.exe W:\DataService\Colo 

%SystemRoot%\explorer.exe W:\DataService\Colo 

:end 
PAUSE 
+1

不要使用百分號的值賦給一個變量。當您需要引用變量的內容時,您只能使用百分號。 – Squashman

回答

0

你要修復第一行:

set /p environment=Goede dag Jeroen! Wilt u beginnen met FME(f), AutoCAD(a), beide(b) of alleen opstart(g)? f/a/b/g :