• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Running a process with a UNC working directory

ForumMaster

Diamond Member
I'm writing a small GUI that supposed to run a .bat file on each of our cognos servers to reset the services properly.

The file will always be located in say:

\\servername\c$\Program Files (x86)\cognos\c8_64\bin64\cogconfig.bat

So from visual studio, i want to basically be able to run the batch file. But i has to be in the working directory to access files like the jre.

If i create a ProcessStartInfo instance,
does the instance.WorkingDirectory feature support UNC path?
does anyone know how to get this to work?

MS support suggest that from the command line, you can use the PUSHD command to temporarily map a UNC path to a network drive so that the CMD can use it.

Anyone have any suggestions? Thanks in advance.
 
"I'm writing a small GUI that supposed to run a .bat file on each of our cognos servers to reset the services properly."

I am not 100% certain what you are trying here. Will the batch file be run on each machine by a locally logged in user? Or is each batch file to be run by a remote user? If you run the batch file from a UNC as a remote user it will run the batch file on your machine, not the remote machine. So if that batch file says 'net stop "service"' it will stop the service on your machine not the remote machine that is holding the batch file. You may be aware of this, I just want to make sure.

If you using Visual Studio and C#/VB.net you can use the System.ServiceProcess.ServiceController class to stop/start remote services. Then you don't need to use batch files.


"So from visual studio, i want to basically be able to run the batch file. But i has to be in the working directory to access files like the jre."

If you add the jre files to your PATH environment variable then they should be found by the batch file.


"MS support suggest that from the command line, you can use the PUSHD command to temporarily map a UNC path to a network drive so that the CMD can use it."

In the batch file you can also do NET USE E: \\servername\c$ to map a network drive then call E:\Program Files (x86)\cognos\c8_64\bin64\cogconfig.bat then call NET USE E: /delete
 
Back
Top