Swatty43 Posted February 3, 2014 Share Posted February 3, 2014 Hi everybody, I have a question, I use this code: _RunDos(' start C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd "' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') To send data input from a user and send it into a cmd file to run a printer install and it works perfectly. However I just ran into a problem when the username has a space in it, it no longer works. So my question is can I use ShellExecute in order to accomplish this when the username has a space? Or is there anyway to modify my _RunDos command in order for it to work with user names with a space. Here is the simple CMD i was using for testing to pass the variables into the cmd file: @echo off color 79 mode con cols=80 lines=40 >nul title Printer Installer set name=%1 set ip=%2 echo. echo You entered: %name% for printer name and %IP% for IP address. echo. pause exit Thank you! Link to comment Share on other sites More sharing options...
Developers Jos Posted February 3, 2014 Developers Share Posted February 3, 2014 Normally you would put the command in double quotes: ' "start C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Swatty43 Posted February 3, 2014 Author Share Posted February 3, 2014 Normally you would put the command in double quotes: ' "start C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' Jos Hi Jos, Thanks for the suggestion that was the first thing I tried and it errors out saying it can find the username. It only shows the first name and that is it. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 3, 2014 Developers Share Posted February 3, 2014 See I've put to opening double quote at the wrong spot. Should be just in front of the c: ' start "C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Swatty43 Posted February 3, 2014 Author Share Posted February 3, 2014 See I've put to opening double quote at the wrong spot. Should be just in front of the c: ' start "C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' Jos That does pull up the cmd but it no longer passes the variables to the batch file. I am still at a loss on what to do. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 3, 2014 Developers Share Posted February 3, 2014 I hope you understood that I was only giving you the first bit of your whole line to change? So are you now using something like this? _RunDos(' start "C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Also wondering why you use Start and not just _RunDos('"C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Or ShellExecute: ShellExecute("C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd",'"' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Swatty43 Posted February 3, 2014 Author Share Posted February 3, 2014 I hope you understood that I was only giving you the first bit of your whole line to change? So are you now using something like this? _RunDos(' start "C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Also wondering why you use Start and not just _RunDos('"C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd" "' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Or ShellExecute: ShellExecute("C:\Users\%username%\Desktop\C1SetupUtility\Files\Scripts\Printers\Xerox.cmd",'"' & GUICtrlRead($PrinterName) & '" "' & GUICtrlRead($PrinterIP) & '"') Jos THANK YOU SOOO MUCH!! Finally got it working with your last example, the only reason why I was using the start command was because that was used in the only working example I found. Thank you for all your help! 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