Index: uspace/app/bdsh/input.c
===================================================================
--- uspace/app/bdsh/input.c	(revision 7fc982031d70068d587677485b8f88bda152d332)
+++ uspace/app/bdsh/input.c	(revision 1e891d04a007a50f5ff2f8d3cda19631f92b76e6)
@@ -169,6 +169,48 @@
 		new_iostate.stdout = to;
 	}
-	
-	rc = run_command(cmd, usr, &new_iostate);
+
+	if (str_cmp(actual_cmd[0], "batch") == 0 && actual_cmd[1] != NULL) {
+		FILE *batch = fopen(actual_cmd[1], "r");
+		if (batch == NULL) {
+			printf("Cannot open file %s\n", actual_cmd[1]);
+			rc = errno;
+		} else {
+			cliuser_t fusr;
+			fusr.name = usr->name;
+			fusr.cwd = usr->cwd;
+			fusr.prompt = usr->prompt;
+			fusr.line = malloc(INPUT_MAX + 1);
+			char *cur = fusr.line;
+			char *end = fusr.line + INPUT_MAX;
+			int c = fgetc(batch);
+			while (fusr.line != NULL) {
+				if (c == '\n' || c == EOF || cur == end) {
+					*cur = '\0';
+					if (cur == fusr.line) {
+						/* skip empty line */
+						rc = 0;
+						free(cur);
+					} else {
+						printf(">%s\n", fusr.line);
+						rc = process_input(&fusr);
+						/* fusr->line was freed by process_input() */
+					}
+					if (rc == 0 && c != EOF) {
+						fusr.line = malloc(INPUT_MAX + 1);
+						cur = fusr.line;
+						end = fusr.line + INPUT_MAX;
+					} else {
+						break;
+					}
+				} else {
+					*cur++ = c;
+				}
+				c = fgetc(batch);
+			}
+			fclose(batch);
+		}
+	} else {
+		rc = run_command(actual_cmd, usr, &new_iostate);
+	}	
 	
 finit_with_files:
