Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

windows powershell

Featured Replies

I try to use the powershell from windows in "Run shell script", because I want to do more on the system than cmd.exe is able to handle.

I tried a modified version of "Rund shell script" where I replaced the cmd.exe by powershell.exe, or used the original script where I send a common like "powershell mode" but I don't get any results back.

Filemaker always hangs.

when I send the commands by Run from Start button and then it works but not in Filemaker.

Any ideas why this does not work?

Markus

  • 2 months later...

FWIW, I'm trying

RunShellScript( ""powershell.exe -ExecutionPolicy Unrestricted -File … ;"true";0)

and it works (YAY), in that it runs the .ps1 file I specify, but when I run it as a schedule on the server, the schedule locks (BOO) with status "RUNNING" and the client by that schedule name persists. Previously when schedules lock like that I have to take the whole DB offline to fix that.

I'm going to try "false" instead of true to see if I can work round it, and I'll post back if that works at least.

(limited) SUCCESS!

http://stackoverflow.com/questions/4745895/powershell-process-hanging-when-called-from-java-application

suggested to me adding "process.getOutputStream().close();¶" to the registergroovy for RunShellScript might do the trick. And indeed it does, for cases where you DON'T wait for the results (the 2nd parameter is "false") the powershell process quits OK if you add an extra line like this

inputStream.close();¶

errorStream.close();¶

process.getOutputStream().close();¶

return "Executed shell command: " + command;¶

I've not got it to work with the waiting for the result "true" option yet which I'd ideally like to do. In practice the shell is never going to take longer than a few seconds, so I can just sleep/wait before continuing what I am doing

MORE - adding the extra line in this bit of code appears to work for "true" waiting for output cases


 try {¶

  process.getOutputStream().close();¶

  if( process.waitFor() == 0 ) { //Successful¶

   stdoutThread.join(); //Wait for all output to be read¶

   return stdout.toString();¶

  } else { //Error when running command¶

   stderrThread.join(); //Wait for entire error message to be read¶

   throw new RuntimeException( stderr.toString() );¶

  }¶

} catch( InterruptedException e ) {¶

  throw new RuntimeException("Process was interrupted; error output is: " + stderr.toString() );¶

}¶

I haven't yet tested if non powershell invoking cmds mess up with these extra commands.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.