Starting FAHClient in CMD, desktop 2 minimized (powershell)

Moderators: Site Moderators, FAHC Science Team

Post Reply
MeeLee
Posts: 1375
Joined: Tue Feb 19, 2019 10:16 pm

Starting FAHClient in CMD, desktop 2 minimized (powershell)

Post by MeeLee »

Can anyone help me with this,

I'm trying to create an noninvasive FAHClient.exe program in a CMD window, in the second virtual desktop in Windows 10; minimized; using files that can be ran without needing admin privileges.

To run an instance of FAHClient without needing admin privileges,
  • download Winrar portable.
  • Extract it to a folder somewhere.
  • Then, download FAHClient.
  • Open the winrar program, and extract the files within the 'latest.tar' file (located in your download directory), to a directory somewhere.
  • Don't forget to modify config.xml, (example below)
  • Create a .bat file with the right parameters to minimize the program (see below).
  • Insert the file in 'Task Scheduler' to set to startup from boot.
  • Create Powerscript files ??? <-- I need help here!
Config.xml content example (in case of CPU folding, at full power):

Code: Select all

<config>
  <!-- Folding Slots -->
  <slot id='0' type='CPU'/>
  <gpu v='false'/>
  <power v='FULL'/>
  <passkey v='************************'/>
  <team v='*****'/>
  <user v='***************'/>
</config>
Replace the stars with your personal data.

The .bat file, to boot FAH in a minimized Command window, looks like this:

Code: Select all

if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
cmd /C "LOCATION\TO\FAHClient.exe"
exit
Remember to set the correct Fahclient.exe download location
This batch file will just minimize the DOS version of FAHClient, in the first desktop, taking up valuable taskbar space, and will not move it to the second virtual desktop.

.bat files can be ran from boot, but have no control over the virtual desktop.
.ps1 (PowerShell script) files, have access to the virtual desktops, but can not be ran from boot.
However, it is possible to call upon a .ps1 file from within a .bat file.

The following link, gives 1 example file on how to start programs in a new desktop, and the other script file controls the desktop.
The 'VirtualDesktop.ps1' file needs to be located within the same directory, as the fah.ps1 file, for it to work (fah.ps1 being a modified example.ps1 file, that starts fahclient instead of notepad).
I have been able to create a new desktop, and run the batch file in the second desktop, but with following issues:

1- The PS1 file creates a new desktop every time it's called upon. I need to find a way to switch between desktops, without creating new ones, or I'll end up with many virtual desktops after multiple reboots.
2- The CMD file running FAH, closes after the PS1 file closes. The 'cmd /C' option (which should start a new instance of CMD) doesn't work here. I'm either able to run FahClient in the bat file minimized in the second desktop (and it won't shift back to the first desktop), or, I'm able to switch to desktop 2 and back with CMD closing...
Either solution is not acceptable.

Anyone with PowerShell experience here?
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Starting FAHClient in CMD, desktop 2 minimized (powershe

Post by bruce »

1) As I understand it, this will only work for CPU slots/FAHCores. (If you discover I'm wrong, please explain.) Windows does not share control of the GPU with other desktops ... only on the one that's running primary screen. I've never tried to create an alternate VirtualDesktop, though so that may or may not work.
2) FAHClient places it's working files in the current directory. To match the default startup, you need a "cd %APPDATA%\FAHClient" before starting FAH's executables.
MeeLee
Posts: 1375
Joined: Tue Feb 19, 2019 10:16 pm

Re: Starting FAHClient in CMD, desktop 2 minimized (powershe

Post by MeeLee »

bruce wrote:1) As I understand it, this will only work for CPU slots/FAHCores. (If you discover I'm wrong, please explain.) Windows does not share control of the GPU with other desktops ... only on the one that's running primary screen. I've never tried to create an alternate VirtualDesktop, though so that may or may not work.
2) FAHClient places it's working files in the current directory. To match the default startup, you need a "cd %APPDATA%\FAHClient" before starting FAH's executables.
1) Haven't tried GPUs yet, as these pcs only have Intel igps
2) Yes, I've noticed some working folders were created in a different directory. That's a help!

An alternative could be to run the client in desktop 1, and move the GUI to desktop 2... Perhaps then GPUs would work?
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Starting FAHClient in CMD, desktop 2 minimized (powershe

Post by bruce »

MeeLee wrote:An alternative could be to run the client in desktop 1, and move the GUI to desktop 2... Perhaps then GPUs would work?
I have no idea.

It probably doesn't matter since the same Windows userid owns both desktops.
MeeLee
Posts: 1375
Joined: Tue Feb 19, 2019 10:16 pm

Re: Starting FAHClient in CMD, desktop 2 minimized (powershe

Post by MeeLee »

cd %APPDATA%\ would only work if FAHClient is installed there.
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Starting FAHClient in CMD, desktop 2 minimized (powershe

Post by bruce »

I don't really understand the advantage of NOT installing.

I commonly remove thee hideconsole because I like to see the console output, but I know that doesn't work for everybody.
Post Reply