Hallo zusammen, folgende Proplematik: ich möchte über einen batch datei die VS08 command prompt starten und da drin (alse mit den ganzen vs08 Umgebungsvariablen) Befehle ausführen. ich habe dann folgende batch geschrieben um dies zu überprüfen. test.bat: @echo on rem starten des VS08 command prompt "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2008\Visual Studio Tools\Visual Studio 2008 Command Prompt.lnk" rem check ob die VS08 umgebungsvariablen aktiv sind set befehl1 befehl2 ich hätte gerne dass die befehle 1 und 2 in der VS08 shell ausgeführt werden? Hat jemmand Ahnung wie man das realisieren kann? Danke
ich gehe davon aus, daß man dem *.lnk-Aufruf Parameter mitgeben kann; letztlich steckt ja nur cmd.exe dahinter. D.H. man kann dahinter noch den Namen einer *.bat angeben, in der du vorher die Befehle unterbringst, oder du gibst die Befehle direkt an in der Kommandozeile, getrennt mit && Aus help cmd:
1 | Starts a new instance of the Windows command interpreter |
2 | |
3 | CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] |
4 | [[/S] [/C | /K] string] |
5 | |
6 | /C Carries out the command specified by string and then terminates |
7 | /K Carries out the command specified by string but remains |
8 | /S Modifies the treatment of string after /C or /K (see below) |
9 | /Q Turns echo off |
10 | /D Disable execution of AutoRun commands from registry (see below) |
11 | /A Causes the output of internal commands to a pipe or file to be ANSI |
12 | /U Causes the output of internal commands to a pipe or file to be |
13 | Unicode |
14 | /T:fg Sets the foreground/background colors (see COLOR /? for more info) |
15 | /E:ON Enable command extensions (see below) |
16 | /E:OFF Disable command extensions (see below) |
17 | /F:ON Enable file and directory name completion characters (see below) |
18 | /F:OFF Disable file and directory name completion characters (see below) |
19 | /V:ON Enable delayed environment variable expansion using ! as the |
20 | delimiter. For example, /V:ON would allow !var! to expand the |
21 | variable var at execution time. The var syntax expands variables |
22 | at input time, which is quite a different thing when inside of a FOR |
23 | loop. |
24 | /V:OFF Disable delayed environment expansion. |
25 | |
26 | Note that multiple commands separated by the command separator '&&' |
27 | are accepted for string if surrounded by quotes. Also, for compatibility |
28 | reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the |
29 | same as /C. Any other switches are ignored. |
30 | |
31 | If /C or /K is specified, then the remainder of the command line after |
32 | the switch is processed as a command line, where the following logic is |
33 | used to process quote (") characters: |
34 | |
35 | 1. If all of the following conditions are met, then quote characters |
36 | on the command line are preserved: |
37 | |
38 | - no /S switch |
39 | - exactly two quote characters |
40 | - no special characters between the two quote characters, |
41 | where special is one of: &<>()@^| |
42 | - there are one or more whitespace characters between the |
43 | two quote characters |
44 | - the string between the two quote characters is the name |
45 | of an executable file. |
46 | |
47 | 2. Otherwise, old behavior is to see if the first character is |
48 | a quote character and if so, strip the leading character and |
49 | remove the last quote character on the command line, preserving |
50 | any text after the last quote character. |
51 | |
52 | If /D was NOT specified on the command line, then when CMD.EXE starts, it |
53 | looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if |
54 | either or both are present, they are executed first. |
55 | |
56 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun |
57 | |
58 | and/or |
59 | |
60 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun |
61 | |
62 | Command Extensions are enabled by default. You may also disable |
63 | extensions for a particular invocation by using the /E:OFF switch. You |
64 | can enable or disable extensions for all invocations of CMD.EXE on a |
65 | machine and/or user logon session by setting either or both of the |
66 | following REG_DWORD values in the registry using REGEDIT.EXE: |
67 | |
68 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions |
69 | |
70 | and/or |
71 | |
72 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions |
73 | to either 0x1 or 0x0. The user specific setting takes precedence over |
74 | the machine setting. The command line switches take precedence over the |
75 | registry settings. |
76 | |
77 | In a batch file, the SETLOCAL ENABLEEXTENSIONS or DISABLEEXTENSIONS arguments |
78 | takes precedence over the /E:ON or /E:OFF switch. See SETLOCAL /? for details. |
79 | |
80 | The command extensions involve changes and/or additions to the following |
81 | commands: |
82 | |
83 | DEL or ERASE |
84 | COLOR |
85 | CD or CHDIR |
86 | MD or MKDIR |
87 | PROMPT |
88 | PUSHD |
89 | POPD |
90 | SET |
91 | SETLOCAL |
92 | ENDLOCAL |
93 | IF |
94 | FOR |
95 | CALL |
96 | SHIFT |
97 | GOTO |
98 | START (also includes changes to external command invocation) |
99 | ASSOC |
100 | FTYPE |
101 | |
102 | To get specific details, type commandname /? to view the specifics. |
103 | |
104 | Delayed environment variable expansion is NOT enabled by default. You |
105 | can enable or disable delayed environment variable expansion for a |
106 | particular invocation of CMD.EXE with the /V:ON or /V:OFF switch. You |
107 | can enable or disable delayed expansion for all invocations of CMD.EXE on a |
108 | machine and/or user logon session by setting either or both of the |
109 | following REG_DWORD values in the registry using REGEDIT.EXE: |
110 | |
111 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion |
112 | |
113 | and/or |
114 | |
115 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion |
116 | |
117 | to either 0x1 or 0x0. The user specific setting takes precedence over |
118 | the machine setting. The command line switches take precedence over the |
119 | registry settings. |
120 | |
121 | In a batch file the SETLOCAL ENABLEDELAYEDEXPANSION or DISABLEDELAYEDEXPANSION |
122 | arguments takes precedence over the /V:ON or /V:OFF switch. See SETLOCAL /? |
123 | for details. |
124 | |
125 | If delayed environment variable expansion is enabled, then the exclamation |
126 | character can be used to substitute the value of an environment variable |
127 | at execution time. |
128 | |
129 | You can enable or disable file name completion for a particular |
130 | invocation of CMD.EXE with the /F:ON or /F:OFF switch. You can enable |
131 | or disable completion for all invocations of CMD.EXE on a machine and/or |
132 | user logon session by setting either or both of the following REG_DWORD |
133 | values in the registry using REGEDIT.EXE: |
134 | |
135 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar |
136 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar |
137 | |
138 | and/or |
139 | |
140 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar |
141 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar |
142 | |
143 | with the hex value of a control character to use for a particular |
144 | function (e.g. 0x4 is Ctrl-D and 0x6 is Ctrl-F). The user specific |
145 | settings take precedence over the machine settings. The command line |
146 | can enable or disable delayed expansion for all invocations of CMD.EXE on a |
147 | machine and/or user logon session by setting either or both of the |
148 | following REG_DWORD values in the registry using REGEDIT.EXE: |
149 | |
150 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion |
151 | |
152 | and/or |
153 | |
154 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion |
155 | |
156 | to either 0x1 or 0x0. The user specific setting takes precedence over |
157 | the machine setting. The command line switches take precedence over the |
158 | registry settings. |
159 | |
160 | In a batch file the SETLOCAL ENABLEDELAYEDEXPANSION or DISABLEDELAYEDEXPANSION |
161 | arguments takes precedence over the /V:ON or /V:OFF switch. See SETLOCAL /? |
162 | for details. |
163 | |
164 | If delayed environment variable expansion is enabled, then the exclamation |
165 | character can be used to substitute the value of an environment variable |
166 | at execution time. |
167 | |
168 | You can enable or disable file name completion for a particular |
169 | invocation of CMD.EXE with the /F:ON or /F:OFF switch. You can enable |
170 | or disable completion for all invocations of CMD.EXE on a machine and/or |
171 | user logon session by setting either or both of the following REG_DWORD |
172 | values in the registry using REGEDIT.EXE: |
173 | |
174 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar |
175 | HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar |
176 | |
177 | and/or |
178 | |
179 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar |
180 | HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar |
181 | |
182 | with the hex value of a control character to use for a particular |
183 | function (e.g. 0x4 is Ctrl-D and 0x6 is Ctrl-F). The user specific |
184 | settings take precedence over the machine settings. The command line |
185 | switches take precedence over the registry settings. |
186 | |
187 | If completion is enabled with the /F:ON switch, the two control |
188 | characters used are Ctrl-D for directory name completion and Ctrl-F for |
189 | file name completion. To disable a particular completion character in |
190 | the registry, use the value for space (0x20) as it is not a valid |
191 | control character. |
192 | |
193 | Completion is invoked when you type either of the two control |
194 | characters. The completion function takes the path string to the left |
195 | of the cursor appends a wild card character to it if none is already |
196 | present and builds up a list of paths that match. It then displays the |
197 | first matching path. If no paths match, it just beeps and leaves the |
198 | display alone. Thereafter, repeated pressing of the same control |
199 | character will cycle through the list of matching paths. Pressing the |
200 | Shift key with the control character will move through the list |
201 | backwards. If you edit the line in any way and press the control |
202 | character again, the saved list of matching paths is discarded and a new |
203 | one generated. The same occurs if you switch between file and directory |
204 | name completion. The only difference between the two control characters |
205 | is the file completion character matches both file and directory names, |
206 | while the directory completion character only matches directory names. |
207 | If file completion is used on any of the built in directory commands |
208 | (CD, MD or RD) then directory completion is assumed. |
209 | |
210 | The completion code deals correctly with file names that contain spaces |
211 | or other special characters by placing quotes around the matching path. |
212 | Also, if you back up, then invoke completion from within a line, the |
213 | text to the right of the cursor at the point completion was invoked is |
214 | discarded. |
215 | |
216 | The special characters that require quotes are: |
217 | <space> |
218 | &()[]{}^=;!'+,`~ |
Einfacher wäre es, sich den Inhalt der Verknüpfung anzusehen. Bei VS2010 steht darin
1 | %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 |
was dem Verfahren von VS2008 zumindest ähnlich sein sollte. %comspec% ist der vollständige Pfad auf cmd.exe Das entscheidende hierbei ist der Aufruf der Batchdatei "vcvarsall.bat", die trägt alle VS-relevanten Umgebungsvariablen ein.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.