Page 1 of 1

Making a folder on Windows with Script Scripter

Posted: Fri Mar 25, 2016 5:07 pm
by gabrielp
Does anyone know how to make a folder via Scripter on Windows? I'm trying to Process.execute with the commands md and mkdir but I'm getting the following error: "Failed to run external process: mkdir".

Re: Making a folder on Windows with Script Scripter

Posted: Fri Mar 25, 2016 5:26 pm
by sander
Command: C:/Windows/System32/cmd.exe
Arguments: /c "mkdir d:\folder"

mkdir runs from within the command prompt, you can't call it directly.

/C Carries out the command specified by string and then terminates

Edit: I misread, thought you was using Execute Command. However via scripting it's the same, call mkdir via cmd.exe.
Edit2: This will do: Process.execute("c:/Windows/System32/cmd.exe /c \"mkdir d:\\folder\"")

Re: Making a folder on Windows with Script Scripter

Posted: Fri Mar 25, 2016 5:43 pm
by gabrielp
Woah, thanks for that. I there any way of doing this for Mac environments so you can get CLI behavior identical to the normal terminal within Scripter?

Re: Making a folder on Windows with Script Scripter

Posted: Fri Mar 25, 2016 6:07 pm
by sander
Not sure, I'm more a Windows guy. Since my Switch is on Windows too I can't really test to figure it out.

Re: Making a folder on Windows with Script Scripter

Posted: Fri Mar 25, 2016 10:14 pm
by gabrielp
Doh! Here's a better way using the Switch Directory class:

Code: Select all

if(!thatDir.exists){
		thisDir.mkdir(that);
	}