Es/Command line: Difference between revisions
Kestrelguy (talk | contribs) (began translating into Spanish, then got tired.) |
Kestrelguy (talk | contribs) m (continued translating, but got tired.) |
||
Line 1: | Line 1: | ||
{{lang|Command line|title=Línea de comandos}} | {{lang|Command line|title=Línea de comandos}} | ||
{{Translate in | {{Translate in Progress:es}} | ||
{{distinguish:es|Command Line Options|desc1={{en}}}} | {{distinguish:es|Command Line Options|desc1={{en}}}} | ||
Line 10: | Line 10: | ||
Hay múltiples formas para acceder a la línea de comandos, pero la más sencilla es el [[w:es:Símbolo del sistema de Windows|símbolo del sistema]]. Para accederle en Windows Vista o después, buscar en el menú inicio para <tt>cmd</tt>. En Windows XP o antes, presione {{key|Win|R}}, teclee <tt>cmd</tt>, luego presione {{key|Enter}}. | Hay múltiples formas para acceder a la línea de comandos, pero la más sencilla es el [[w:es:Símbolo del sistema de Windows|símbolo del sistema]]. Para accederle en Windows Vista o después, buscar en el menú inicio para <tt>cmd</tt>. En Windows XP o antes, presione {{key|Win|R}}, teclee <tt>cmd</tt>, luego presione {{key|Enter}}. | ||
{{tip:es|If you're in a hurry, commands can be executed directly from the start menu search box or the Run dialogue. But don't start doing that just yet.}} | {{tip:es|If you're in a hurry, commands can be executed directly from the start menu search box or the Run dialogue. But don't start doing that just yet.}} | ||
{{todo|translate this. no sé como usar el condicional.}} | |||
{{tip:es|Copiar y pegar son un poco extraños en CMD. Para pegar, haga clic derecho y elija la opción "menu". Para copiar, haga clic derecho y elija "Mark", después arrastre su ratón sobre el área que quiere y haga clic derecho otra vez.}} | {{tip:es|Copiar y pegar son un poco extraños en CMD. Para pegar, haga clic derecho y elija la opción "menu". Para copiar, haga clic derecho y elija "Mark", después arrastre su ratón sobre el área que quiere y haga clic derecho otra vez.}} | ||
=== Comandos === | === Comandos === | ||
Ahora está preparado para entrar comandos. Teclee los comandos y presione {{key|Enter}} cuando termina. Aquí está un ejemplo que puede tratar: | |||
"%sourcesdk%\bin\orangebox\bin\bspzip.exe" | "%sourcesdk%\bin\orangebox\bin\bspzip.exe" | ||
Y aquí está que pasa: | |||
# '''<code>%sourcesdk%</code>''' | # '''<code>%sourcesdk%</code>''' es un atajo a la carpeta del SDK, creado cuando el lanzador de SDK se lanza. Es mucho mas fácil que mecanografiar <code>C:\Program Files\Steam\steamapps\<su nombre de cuenta de Steam>\sourcesdk\</code>, y va a verlo mucho en este sitio.{{tip:es|Puede crear un atajo directamente a la carpeta "Tools". Busque como crear "environment variables" y apunte uno a <tt>"%sourcesdk%\bin\orangebox\bin\"</tt>.}} | ||
# The '''quote marks''' at the start and end ensure that the command isn't split into two by the space character in it. What space? The one in <code>C:\Program Files\</code> of course! If there ''isn't'' a space in the path then the quotes aren't needed. {{warning:es|Don't put parameters (see below) within quotes unless they actually require it. Certainly don't put them in the same set of quotes as the tool's.}} | # The '''quote marks''' at the start and end ensure that the command isn't split into two by the space character in it. What space? The one in <code>C:\Program Files\</code> of course! If there ''isn't'' a space in the path then the quotes aren't needed. {{warning:es|Don't put parameters (see below) within quotes unless they actually require it. Certainly don't put them in the same set of quotes as the tool's.}} | ||
# The remainder of the command is a bog-standard '''path''' to the [[BSPZIP]] tool that you should be familiar with from Windows. {{tip:es|<code>.exe</code> files' extensions aren't actually needed, but are included here for clarity.}} | # The remainder of the command is a bog-standard '''path''' to the [[BSPZIP]] {{en}} tool that you should be familiar with from Windows. {{tip:es|<code>.exe</code> files' extensions aren't actually needed, but are included here for clarity.}} | ||
=== | === Parámetros === | ||
That command will run BSPZIP, but all the program will do is print out the further commands you can give to make it actually ''do'' things. | That command will run BSPZIP, but all the program will do is print out the further commands you can give to make it actually ''do'' things. | ||
Line 39: | Line 40: | ||
Note that a command doesn't always take an argument, and that sometimes there are commands that doesn't have a keyword: you just give a value, typically a file name, and the tool does its thing. | Note that a command doesn't always take an argument, and that sometimes there are commands that doesn't have a keyword: you just give a value, typically a file name, and the tool does its thing. | ||
If you examine [[BSPZIP|BSPZIP's article]] you will see that the command above will take whatever files are embedded in the map and stick them in a .zip file somewhere on the hard drive. But where? The answer follows: | If you examine [[BSPZIP|BSPZIP's article]] {{en}} you will see that the command above will take whatever files are embedded in the map and stick them in a .zip file somewhere on the hard drive. But where? The answer follows: | ||
=== The Working Directory === | === The Working Directory === | ||
Line 62: | Line 63: | ||
Aside from the fact that nothing is immediately executed, creating a batch file and typing straight into the command prompt are more or less the same. Type the command, hit {{key|Enter}}, type the next. There are only two things you should know: | Aside from the fact that nothing is immediately executed, creating a batch file and typing straight into the command prompt are more or less the same. Type the command, hit {{key|Enter}}, type the next. There are only two things you should know: | ||
=== | === Detener === | ||
The <code>pause</code> command will cause the CMD window that opens whenever the batch file is executed to wait for a keystroke to continue. This is vital for examining what's going on as otherwise it would close as soon as the operation had completed, which often takes only a split second. For instance: | The <code>pause</code> command will cause the CMD window that opens whenever the batch file is executed to wait for a keystroke to continue. This is vital for examining what's going on as otherwise it would close as soon as the operation had completed, which often takes only a split second. For instance: | ||
Line 69: | Line 70: | ||
pause | pause | ||
=== | === Substitución de nombres de archivos === | ||
In a similar manner to <code>%sourcesdk%</code>, the words <code>%1</code> to <code>%9</code> will be replaced by the path to any files that are dragged and dropped onto the batch file. | In a similar manner to <code>%sourcesdk%</code>, the words <code>%1</code> to <code>%9</code> will be replaced by the path to any files that are dragged and dropped onto the batch file. | ||
Revision as of 20:27, 15 June 2022
Template:Translate in Progress:es

Las herramientas del Source SDK de la línea de comandos son los que se operan por instrucciones escritas, en lugar de hacer clic en botones y navegar para archivos (en que GUIs son basadas. Este artículo va a dar un resumen breve sobre como usarlos.
Básicos
Hay múltiples formas para acceder a la línea de comandos, pero la más sencilla es el símbolo del sistema. Para accederle en Windows Vista o después, buscar en el menú inicio para cmd. En Windows XP o antes, presione ⊞ Win+R, teclee cmd, luego presione ↵ Enter. Template:Tip:es
Comandos
Ahora está preparado para entrar comandos. Teclee los comandos y presione ↵ Enter cuando termina. Aquí está un ejemplo que puede tratar:
"%sourcesdk%\bin\orangebox\bin\bspzip.exe"
Y aquí está que pasa:
%sourcesdk%
es un atajo a la carpeta del SDK, creado cuando el lanzador de SDK se lanza. Es mucho mas fácil que mecanografiarC:\Program Files\Steam\steamapps\<su nombre de cuenta de Steam>\sourcesdk\
, y va a verlo mucho en este sitio.Template:Tip:es- The quote marks at the start and end ensure that the command isn't split into two by the space character in it. What space? The one in
C:\Program Files\
of course! If there isn't a space in the path then the quotes aren't needed.Aviso:Don't put parameters (see below) within quotes unless they actually require it. Certainly don't put them in the same set of quotes as the tool's.
- The remainder of the command is a bog-standard path to the BSPZIP
tool that you should be familiar with from Windows. Template:Tip:es
Parámetros
That command will run BSPZIP, but all the program will do is print out the further commands you can give to make it actually do things.
The commands accepted by each tool vary, and are one of the things this site documents. But the pattern of usage is the same every time:
<program> <command> <argument(s)> <command> <argument(s)> ...
Notice how everything is separated by a space character; remember the quotes trick if this becomes a problem. So:
"%sourcesdk%\bin\orangebox\bin\bspzip.exe" -extract mymap.bsp contents.zip
-extract
is a command, which tells BSPZIP what you're trying to do. Command are normally prefixed with a '-
' character.mymap.bsp
andcontents.zip
are arguments, which give more details about how the command should perform its task.
Note that a command doesn't always take an argument, and that sometimes there are commands that doesn't have a keyword: you just give a value, typically a file name, and the tool does its thing.
If you examine BSPZIP's article you will see that the command above will take whatever files are embedded in the map and stick them in a .zip file somewhere on the hard drive. But where? The answer follows:
The Working Directory
You must pass a path to the location of every file or tool you want to work with. Except, that is, if it's in the 'working directory'. This is displayed before the cursor every time CMD is waiting for input, followed by a >
, and will probably be pointing towards your user folder right now.
This means that if we type mymap.bsp
or contents.zip
as in the example above, BSPZIP will look for C:\Users\You\mymap.bsp
and create C:\Users\You\contents.zip
(assuming that's where your user folder is). That most likely isn't what you want, and to fix it you need to use the cd
('change directory') command before starting the tool itself:
cd "C:\Users\You\Documents\My mod\maps\"
That's a command followed by a parameter without a keyword, wrapped in quotes because of the space in My mod
. Now BSPZIP will look for the two files in that folder, and hopefully find them there.
Alternatively you could type the full path for each file into the command, but since there are two such files in the command it's faster to cd first. Template:Tip:es
The working directory is not stored between sessions: it must be set every time you open the command prompt. Typing it in all the time gets old fast, which is why we have batch files.
Batch Files
Commands can be written down in batch files that can then be executed at any time. To create one, save or rename any text file with the extension .cmd
.
Aside from the fact that nothing is immediately executed, creating a batch file and typing straight into the command prompt are more or less the same. Type the command, hit ↵ Enter, type the next. There are only two things you should know:
Detener
The pause
command will cause the CMD window that opens whenever the batch file is executed to wait for a keystroke to continue. This is vital for examining what's going on as otherwise it would close as soon as the operation had completed, which often takes only a split second. For instance:
cd "C:\Users\You\Documents\My mod\maps\" "%sourcesdk%\bin\orangebox\bin\bspzip.exe" -extract mymap.bsp ..\contents.zip pause
Substitución de nombres de archivos
In a similar manner to %sourcesdk%
, the words %1
to %9
will be replaced by the path to any files that are dragged and dropped onto the batch file.
In the example being used by this article you'll have to get a little creative, since there are two values that need files but you only want to have to drag the map over. You could try something like this:
"%sourcesdk%\bin\orangebox\bin\bspzip.exe" -extract %1 %1_contents.zip
Which, if mymap.bsp
is dropped onto it, will create mymap.bsp_contents.zip
in the same folder. No need for cd
this time, but a batch file like this won't work if it's just double-clicked on.