When you configure the gold disc K3 client, you may encounter a problem. If you enable the domain to handle it well, otherwise you must save the client computer and the server with a considerable user and the password must be consistent, the client can only use this user to log on to and start the client. This is inconvenient to use, and users must be added to the server and each client. So I thought of a compromise. All users use k3test. Only this user is added to the server for K3. The client creates the same user k3test.
When using K3. when using K3. you can use another K3. RunAs can implement this function, but it is inconvenient to enter a password in the Command window every time, causing trouble and error for the end user.
There are several ways to improve:
I. Write a program by calling the createprocessasuser API. I don't want to make it too difficult, so I don't want to use it.
2. RunAs can have the option to save the password. This is more realistic (Save the following code as a. BAT file and the password is required for the first run)
# Option/savecred can be saved after you enter the password for the first time. You do not need to enter the password again.
RunAs/User: k3test/savecred "C:/program files/Kingdee/k3erp/k3express/kdmain.exe"
3. Run the script to open a CMD and send the password with sendKey (Save the following code as a. vbs file)
'---------------------------
'Use another user identity to run the gold disc K3 Program
'---------------------------
Set SH = wscript. Createobject ("wscript. Shell ")
Sh. Run ("CMD/B ")
Wscript. Sleep 500
Sh. sendkeys "RunAs/User: k3test" 'User Name
Wscript. Sleep 500
Sh. sendkeys "" C:/program files/Kingdee/k3erp/k3express/kdmain.exe """
Wscript. Sleep 1000
Sh. sendkeys "{enter }"
Wscript. Sleep 500
Sh. sendkeys "1234" 'Password
Sh. sendkeys "{enter }"
Sh. sendkeys "exit"
Sh. sendkeys "{enter }"
This is just an example. You can change it to support other programs as required.