Run script using CMD with parameters


In my use-case, I wanna run my script with a couple of parameters. This is done using photoshop ....\script.psjs in Powershell. But I couldn’t find any info on whenever this is possible, and if so, how to do it.

So my question is, is this possible? If yes, how?

Thanks sincerely,


Alternatively, using a relative path? %Temp%\\Script\\config.json didn’t seem to work, but something like that would also suit.

Passing arguments are currently impossible, but will be possible in the future. InDesign already allows it, in fact.

It seems to be possible to send data via files, since the fs module can read any file in any location.

People familiar with UXP will be surprised that this is possible. UXP plugin is so strict about permissions, but scripts don’t need any permission for fs.

const fs = require('fs') ;
const os = require('os') ;
const { app } = require('photoshop') ;

try {
  const str = fs.readFileSync(path.join(os.homedir(), 'Desktop', 'config.json'), {encoding: 'utf-8'}) ;
  await app.showAlert(JSON.stringify(JSON.parse(str))) ;
} catch(e) {
  await app.showAlert(e) ;

Thanks sincerely,

I was aware that reading files was possible, but I couldn’t figure out how to get the home directory.
It seems I completely missed the “os” module. So thanks a lot, I’ll figure something out!

Now I don’t have to hard-code the path anymore :see_no_evil:

1 Like