I have a HTA to do some tasks, this sub is for manipulating some local directories. When I run this line:
oShell.run "rename ""C:\DSS\Scanbay\Data"" ""DataX"""
it doesnt work, naturally I have defined oShell ect...
When I run this line as a batch file:
rename "C:\DSS\Scanbay\Data" "DataX"
it works fine!
I cannot figure out why the vbs returns file not found error, any help please?
oShell.Run "cmd /c rename ""C:\DSS\Scanbay\Data"" ""DataX""
instead. You might find SS64 on VBScript '.Run' useful. The.ShellExecute
method might also be of interest. – Jeff ZeitlinRENAME
command is an internal cmd.exe command so if you are not explicitly within a batch file or at a cmd prompt you will need to specifiy the use ofCMD /C
within your vbscript as @JeffZeitlin has pointed out. – Squashman