Hi
I'm trying to run a simple powershell command through (command "_shell" ...) to change .txt file encoding
(setq dwgx (getvar 'dwgprefix))
(setq geox (getfiled "TRW Geocoding file" dwgx "txt" 0))
(setq geox-utf8 (vl-string-subst "-utf8.txt" ".txt" geox))
(setq str (strcat "Powershell.exe Get-Content -Path " geox " | Out-File -FilePath " geox-utf8 " -Encoding ascii"))
(command "_shell" str)
When I pass the string to the _shell command, it just returns nil, and the file is never created.
However when I enter it inside a standalone powershell window (Get-Content -Path [path] | Out-File -FilePath [utf8 path] -Encoding ascii) a new .txt file with the proper encoding is created. (Works even without quotes, the path doesn't contain spaces).
Any hints?
Solved! Go to Solution.
Solved by davidkoh007. Go to Solution.
Figured a workaround
(setq ws (vlax-get-or-create-object "WScript.Shell"))
(vlax-invoke ws 'exec str)
Worked.
I am not one of the robots you're looking for
Can't find what you're looking for? Ask the community or share your knowledge.