blumi Posted March 3, 2016 Author Share Posted March 3, 2016 I copied the code from MattHiggs, thought when he posts here some example in the forum, that the code is correct. The code should look more like this I think. RunWait ( @ComSpec & ' /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Export-StartLayout -As bin -Path c:\temp\test.bin -verbose', @SystemDir ) Link to comment Share on other sites More sharing options...
water Posted March 3, 2016 Share Posted March 3, 2016 If you want to keep the DOS window open to inspect some error messages you could use: RunWait ( @ComSpec & ' /k ... My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
blumi Posted March 3, 2016 Author Share Posted March 3, 2016 Thanks, thats cool. Of course I didn't know this. Powershell starts, but the command is not known. + Export-StartLayout -As bin -Path c:\temp\test.bin -verbose + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Export-StartLayout:String) [], CommandNotFoundExcep tion + FullyQualifiedErrorId : CommandNotFoundException I thought Export-Startlayout is a command from powershell, isn't it? Link to comment Share on other sites More sharing options...
iamtheky Posted March 3, 2016 Share Posted March 3, 2016 (edited) My code works, and is the only way it has worked for me. Is your cmd path also at syswow64, in addition to showing that error? Edited March 3, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
water Posted March 3, 2016 Share Posted March 3, 2016 You did not tell us which version of Windows you run My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
blumi Posted March 3, 2016 Author Share Posted March 3, 2016 (edited) Windows 10 x64 Edited March 3, 2016 by blumi Link to comment Share on other sites More sharing options...
water Posted March 3, 2016 Share Posted March 3, 2016 I'm not running Windows 10 so unfortunately I can't help you with that. But I'm sure on Google you will find a lot of hits My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MattHiggs Posted March 5, 2016 Share Posted March 5, 2016 (edited) On 3/3/2016 at 4:14 AM, blumi said: Tried this RunWait ( @ComSpec & ' /c @powershell Export-StartLayout -As bin -Path c:\temp\test.bin -verbose', @SystemDir ) and RunWait ( @ComSpec & ' /c @powershell -c Export-StartLayout -As bin -Path c:\temp\test.bin -verbose', @SystemDir ) Nothing works YOu forgot the double quote surrounding your powershell command. It should read Run ( @Comspec & ' /c @powershell -c "powershell command"' ) Edited March 5, 2016 by MattHiggs Link to comment Share on other sites More sharing options...
MattHiggs Posted March 5, 2016 Share Posted March 5, 2016 (edited) On 3/3/2016 at 6:05 AM, blumi said: I copied the code from MattHiggs, thought when he posts here some example in the forum, that the code is correct. The code should look more like this I think. RunWait ( @ComSpec & ' /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Export-StartLayout -As bin -Path c:\temp\test.bin -verbose', @SystemDir ) The code is correct. If you had copied and pasted like you said you had, then it should have compiled and run no problem. I would never post something I hadn't verified first. Maybe you need glasses since you failed to put the powershell command in double quotes like the example I provided. I will not deny that there is more than one solution to a problem, but before you discount mine, try getting it right first. Edited March 5, 2016 by MattHiggs Link to comment Share on other sites More sharing options...
MattHiggs Posted March 5, 2016 Share Posted March 5, 2016 On 3/3/2016 at 6:05 AM, blumi said: I copied the code from MattHiggs, thought when he posts here some example in the forum, that the code is correct. The code should look more like this I think. RunWait ( @ComSpec & ' /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Export-StartLayout -As bin -Path c:\temp\test.bin -verbose', @SystemDir ) You did remember to change Powershells execution policy from "restricted" when you started coding right? Powershell Command: Set-ExecutionPolicy unrestricted. I would think that would be obvious, but your double quote learning disability requires the consideration of all possibilities, Link to comment Share on other sites More sharing options...
rudi Posted March 7, 2016 Share Posted March 7, 2016 Hi. the "@" is turning off the "echo". You propably know it already from the CMD and BAT script's usual #1 line: @echo off Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now