Running Multiple Commands using Cmd

How can i run multiple cmd commands in the single cmd session? So for example i want to start cmd, followed by "cd ", maybe follow it by “dir > test.txt” followed by “whoami”

As soon as i launch the Cmd.exe /C it compiles that line and closes the cmd session.

The best way to do this is either using the “appendfile” or “createfile” Action Script commands then run it as a batch file.

appendfile cd \
appendfile dir > test.txt
appendfile whoami >> test.txt
move __appendfile test.bat
wait cmd.exe /C test.bat

OR

createfile until THISISTHEEND
cd \
dir > test.txt
whoami >> test.txt
THISISTHEEND
move __createfile test.bat
wait cmd.exe /C test.bat
1 Like

Another option is to just always use absolute paths. I prefer this method most of the time because I prefer not to use BAT files in actionscript so that I get feedback for every command instead of the BAT file as a whole.

parameter "pathname" = "\test"
wait { parameter "pathname" }\file.exe
wait dir { parameter "pathname" } > { parameter "pathname" }\text.txt
wait { parameter "pathname" }\whoami >> { parameter "pathname" }\test.txt
1 Like

Interesting. Thank you so much guys; Will test it. I had another question related to Dir via command line vs find files command. Will open a separate thread.

1 Like