Page 2 sur 2
Re: The syntax for the file name... is incorrect
Posté : 27 sept. 2018 - 17:12
par empbilly
I did the tests and when I run a cmd via psexec it is as shown in the image below.
authority nt\system
https://ibb.co/iwCjWp (I do not know why the image does not appear being in the [img] tag)
Re: The syntax for the file name... is incorrect
Posté : 27 sept. 2018 - 17:48
par dcardon
Hi Elias,
empbilly a écrit : ↑27 sept. 2018 - 17:12
I did the tests and when I run a cmd via psexec it is as shown in the image below.
authority nt\system
https://ibb.co/iwCjWp (I do not know why the image does not appear being in the [img] tag)
So in that cmd.exe you are "Local System" (it is the real root account on Windows). Now you just need to run the same command line that you have put in your
file and see if it is running properly.
Denis
Re: The syntax for the file name... is incorrect
Posté : 27 sept. 2018 - 21:18
par empbilly
dcardon,
I got in touch with the company that developed the software and was given another variable to silently remove.
Code : Tout sélectionner
C:\ProgramData\{5F3A4BBA-1519-45F2-9BF7-1E9924E32CAA}>"Surfer(11.1.719)_Installer.exe" REMOVE=TRUE MODIFY=FALSE UNINSTALL=TRUE /s
When executing this command in cmd via psexec.exe another window is showing that they do not find a file or folder.
The window tells the message below:
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
Only after I press OK does the uninstall continue.
The path C:\Windows\system32\config\systemprofile exists, but "Desktop" no.
Would there be any way to simulate OK click?
Re: The syntax for the file name... is incorrect
Posté : 28 sept. 2018 - 15:07
par vcardon
empbilly a écrit : ↑27 sept. 2018 - 21:18
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
How about you create an empty folder C:\Windows\system32\config\systemprofile\Desktop in your install script ?
If your software uninstallation script wants to remove a file or a folder and it crashes because it doesn't find the file, then why not just create it.
WAPT is often useful to correct problems with commercial software installation/removal scripts.
Vincent
Re: The syntax for the file name... is incorrect
Posté : 28 sept. 2018 - 15:24
par dcardon
Hi Elias,
empbilly a écrit : ↑27 sept. 2018 - 21:18
I got in touch with the company that developed the software and was given another variable to silently remove.
Code : Tout sélectionner
C:\ProgramData\{5F3A4BBA-1519-45F2-9BF7-1E9924E32CAA}>"Surfer(11.1.719)_Installer.exe" REMOVE=TRUE MODIFY=FALSE UNINSTALL=TRUE /s
When executing this command in cmd via psexec.exe another window is showing that they do not find a file or folder.
The window tells the message below:
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
Only after I press OK does the uninstall continue.
The path C:\Windows\system32\config\systemprofile exists, but "Desktop" no.
Would there be any way to simulate OK click?
Like Vincent said previously, creating the C:\Windows\system32\config\systemprofile\Desktop folder before hand will probably do the trick. The uninstall script probably tries to remove an icon it had copied during installation to do some cleanup, but it fails miserably because the "Local System" user does not have such a folder (C:\Windows\system32\config\systemprofile\ is the value of %USERPROFILE% for "Local System"). And it explains why it was working when doing it in a user context.
In your case the unsinstall was failing because the pop up windows was display on the non visible graphic buffer of "Local System".
Now you see why using
is a good way to check the behavior of the installer.
The best thing would be for the developer to fix its install/uninstall script!
Cheers,
Denis
Re: The syntax for the file name... is incorrect
Posté : 28 sept. 2018 - 19:29
par empbilly
hello vcardon and dcardon!! Thanks for the whole help!!!
It's works !!!
Had not thought about creating the folder to be later removed.
The final script:
Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
import os
uninstallkey = []
destdir = makepath(programfiles, "Golden Software", "Surfer 11")
exefile = "Surfer.exe"
inidir = "%s\\AppData\\Gradient.ini" % destdir
pstools = makepath(programfiles, "mspstools")
error_env = os.environ['WINDIR']
error_path = r'%s\system32\config\systemprofile\Desktop' % error_env
def install():
if not os.path.isdir(error_path):
os.makedirs(error_path)
if os.path.exists(error_path):
print("%s was success created!" % error_path)
print('Uninstalling old versions of surfer...')
for soft in installed_softwares("Surfer"):
try:
cmd = WAPT.uninstall_cmd(soft['key'])
if isinstance(cmd,list) and len(cmd) == 1:
cmd = cmd[0]
if destdir and not 'UNINSTALL=YES' in cmd:
cmd = cmd + ' UNINSTALL=YES' + ' /s'
run(cmd)
else:
if not destdir and 'UNINSTALL=YES' in cmd:
run(cmd)
except ValueError:
pass
print('Uninstalling old versions of Surfer completed!')
print('Installing Surfer...')
install_msi_if_needed('surfer.msi')
if os.path.exists(destdir):
filecopyto("Gradient.ini", "%s\\AppData" % destdir)
if os.path.exists(inidir):
print("Gradient.ini copied to the folder %s\\AppData" % destdir)
If you have something to improve on in the script, I'd be grateful for the suggestion. I am programming in python and I am still not aware of the best practices. Thank you!