github.com/aspring/packer@v0.8.1-0.20150629211158-9db281ac0f89/website/source/docs/provisioners/windows-shell.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Windows Shell Provisioner" 4 description: |- 5 The windows-shell Packer provisioner runs commands on Windows using the cmd shell. 6 --- 7 8 # Windows Shell Provisioner 9 10 Type: `windows-shell` 11 12 The windows-shell Packer provisioner runs commands on a Windows machine 13 using `cmd`. It assumes it is running over WinRM. 14 15 ## Basic Example 16 17 The example below is fully functional. 18 19 ```javascript 20 { 21 "type": "windows-shell", 22 "inline": ["dir c:\\"] 23 } 24 ``` 25 26 ## Configuration Reference 27 28 The reference of available configuration options is listed below. The only 29 required element is either "inline" or "script". Every other option is optional. 30 31 Exactly _one_ of the following is required: 32 33 * `inline` (array of strings) - This is an array of commands to execute. 34 The commands are concatenated by newlines and turned into a single file, 35 so they are all executed within the same context. This allows you to 36 change directories in one command and use something in the directory in 37 the next and so on. Inline scripts are the easiest way to pull off simple 38 tasks within the machine. 39 40 * `script` (string) - The path to a script to upload and execute in the machine. 41 This path can be absolute or relative. If it is relative, it is relative 42 to the working directory when Packer is executed. 43 44 * `scripts` (array of strings) - An array of scripts to execute. The scripts 45 will be uploaded and executed in the order specified. Each script is executed 46 in isolation, so state such as variables from one script won't carry on to 47 the next. 48 49 Optional parameters: 50 51 * `binary` (boolean) - If true, specifies that the script(s) are binary 52 files, and Packer should therefore not convert Windows line endings to 53 Unix line endings (if there are any). By default this is false. 54 55 * `environment_vars` (array of strings) - An array of key/value pairs 56 to inject prior to the execute_command. The format should be 57 `key=value`. Packer injects some environmental variables by default 58 into the environment, as well, which are covered in the section below. 59 60 * `execute_command` (string) - The command to use to execute the script. 61 By default this is `{{ .Vars }}"{{ .Path }}"`. The value of this is 62 treated as [configuration template](/docs/templates/configuration-templates.html). 63 There are two available variables: `Path`, which is 64 the path to the script to run, and `Vars`, which is the list of 65 `environment_vars`, if configured. 66 67 * `remote_path` (string) - The path where the script will be uploaded to 68 in the machine. This defaults to "/tmp/script.sh". This value must be 69 a writable location and any parent directories must already exist. 70 71 * `start_retry_timeout` (string) - The amount of time to attempt to 72 _start_ the remote process. By default this is "5m" or 5 minutes. This 73 setting exists in order to deal with times when SSH may restart, such as 74 a system reboot. Set this to a higher value if reboots take a longer 75 amount of time.